Questions tagged [type-conversion]
Type conversion is the way of implicitly or explicitly changing an entity of one data type into another. This is done to take advantage of certain features of type hierarchies or type representations.
13,635
questions
-4
votes
1
answer
58
views
How to generate a byte array from a List<int> in C#?
I am trying to reverse engineer some old code that is undocumented. I have a Base64 string that is converted to a byte array and then converted with the following code:
public static IEnumerable<...
-3
votes
1
answer
71
views
How to convert a byte array to a List<int> in c#?
I am trying to reverse engineer some old data. The database holds a base64 string that represents a List of type int object in C#. That of course can be easily converted to a byte array, but that is ...
0
votes
0
answers
32
views
Converting a python file to .exe [closed]
I recently made a script with python that takes data from google sheets and I need to include a .json file in the folder so that the script is able to take the data. There are no problems there but I ...
0
votes
0
answers
25
views
Conversion from string to 'Double' is not valid
Updated Code: After turning on Option Strict On, as suggested, I am now receiving the following error: For both the tbMonday1 and tbMonday2 variables:
Option strict On disallows implicit conversions ...
2
votes
0
answers
71
views
How to use FixedU128?
I'm fetching floating value in offchain worker though lite-json.
Json data:
{
"price": 0.5
}
Here is the implementation to fetch the price:
let price_str = match obj.clone() {
JsonValue:...
2
votes
1
answer
82
views
How to convert a unicode number to a std::wstring?
Is there an easy way to convert a Unicode number to a std::wstring?
e.g. I want to convert U+1E9E (=16785054) to ẞ.
-1
votes
0
answers
7
views
Looking for someone or something to convert Mimer dbf. files to XL or similar
Looking for somebody or something to convert database files. Mimer dbf files used in a dental management program. I'm wanting to change programs but the new provider cannot convert the Mimer data. ...
0
votes
1
answer
18
views
Extract string literal type of an interface's function's arguments
In @types/phantom, there is a WebPage interface, which includes the following function:
interface WebPage {
// ...
property(
key:
| "content"
| "...
0
votes
2
answers
26
views
I have time series data with the dates in YYYYMX where X refers to the months from 1 to 12. I want to convert to YYYY-XX where XX is a numbero
What I am coding is:
df = pd.read_excel("Ahiakpor.xlsx", index_col = 0)
df.index = pd.to_datetime(
df.index
.str.replace("M1", "-01")
.str.replace("M2&...
0
votes
0
answers
16
views
Problem with GSpread, Python, and MySQL 'list_to_mysql'
I have been struggling with multiple versions of this file, and have tried so many things. I originally needed it to automatically pull a spreadsheet out of GSpread, and put it into mySQL. I got one ...
0
votes
0
answers
26
views
R: run a python function with reticulate passing arguments as R variables (need r_to_py()?)
I am using the Python program stitchr inside an R package, so I run it with reticulate.
I follow the instructions listed here.
I create a file "run_stitchr.py" with these contents:
# import ...
0
votes
1
answer
42
views
Conversion problem: Large TIFF File to XYZ Format
I am working with a TIFF file named CHELSAcruts_tmax_4_1981_V.1.0.tif (size: 97M).
I want to convert this file first to XYZ format and subsequently to CSV.
Attempts and Challenges
Online Converter ...
0
votes
0
answers
32
views
Convert a float value to date time in Oracle [duplicate]
I have a column with the following values (they are date values and were converted in Excel to numeric values), the column type is varchar however they represent float values.
45223.43333
45214.41042
...
2
votes
1
answer
77
views
Implicit conversion of constant literal
In the below code:
func main() {
var a uint8 = 'x'
fmt.Println(a)
}
'x' is a constant literal (of untyped rune)
Does variable declaration for a involve implicit conversion of type from ...
-1
votes
0
answers
32
views
Looking for cleaner way to handle a potential nullable conversion to generic type
Here's my code:
PropertyType GetSamplePulledDate<PropertyType>()
{
DateTime? date = String.IsNullOrEmpty(PropertyEditor.DtPckerSamplePulled.Text)
? null
: ...
-1
votes
0
answers
6
views
how to post telegraphapi by postman
how to post md content at telegram api? (content type text on telegraph api)
// const fs = require('fs');
// const markdownIt = require('markdown-it');
// const mdContent = JSON.stringify(fs....
0
votes
1
answer
26
views
Can I implement a generic From<> trait for a generic type for any other implementation than from itself?
I made a generic Vector struct, used with different T types :
struct Vector<T> {
data: [T; 3],
}
I already implemented some generic traits for mathematical operands (Eq, Index, std::ops::...
1
vote
1
answer
22
views
Linear regression using groupby and sklearn: How do I save the results of model.score in a new dataframe with the associated group name?
I have a dataset with 99 groups. Below is an example subset containing three groups.
Name conc height
0 Oxaloacetate 20 9047
1 Oxaloacetate 50 24966
2 Oxaloacetate 100 47028
3 L-...
-1
votes
0
answers
24
views
How to convert type pdftron.PDF.PDFDoc to List<byte[]>
private async Task<List<byte[]>> GetEmailReadyOriginalPaper()
{
const string functionName = "GetEmailReadyOriginalPaper";
try
{
...
0
votes
1
answer
38
views
How to use conversion type functions in oracle without using <select .. from> clause
I want to use <to_date> function on a string (which doesn't require any data from any table) in oracle without using <select .. from> clause
I want to show the string '01011912' into to ...
0
votes
1
answer
36
views
How to convert a bold text with the html b or strong tags into a directly bold text without tags as happens on the site yaytext.com
We need to allow copying and pasting of all correctly formatted text from our management system on Facebook and we have noticed that now, by doing this operation, the bold text is lost. Furthermore, ...
0
votes
1
answer
32
views
Convert a byte stream from a smartmeter to a string
From a smartmeter I receive a bytestream via USB IR Sensor on a Raspberry PI like this:
CHAR = b'\x00\x86\x1b\x1b\x1b\x1b\x01\x01\x01\x01v\x05\x18\xe0\x99:b\x00b\x00rc\x01\x01v\x01\x01\x05\x08J\xdd\...
0
votes
1
answer
48
views
Unexpected cell content after type conversion
I have a simple Sub procedure which gives the expected value of 0.32 in the Immediate window but gives a "strange" number in a Worksheet cell (A1: 0.319999992847443). Any idea why this ...
0
votes
3
answers
77
views
How do I convert a normal string in another format?
How do I convert a normal string in another format using Python script?
For exp: a normal "String" into BOLD "String" or other format fonts!
I tried with these two modules but ...
0
votes
0
answers
17
views
Type Mismatch: cannot convert from Object to ObjectName [duplicate]
I have a Class named Filial.
On my Main class, i created a ArrayList of it:
ArrayList<Filial> filiais = new ArrayList<Filial>();
Still on my Main, i created a method:
public static ...
2
votes
1
answer
108
views
How to convert bytes to a float32 array in Go?
I am writing an array of float32 numbers from a Python script to an Elasticache Redis cluster in bytes format, then reading the bytes (as a string) from Elasticache in a Go script. How do I convert ...
-2
votes
2
answers
32
views
Weird output of JavaScript number.toString method
I'm very new with JavaScript and I was trying to play around doing a function that should do some basic validation of phone numbers. I know for a professional result you should use regex but I'm just ...
0
votes
0
answers
47
views
How would I turn Int 623527832412487691 to Str 623527832412487691 in JavaScript
Im trying to save 623527832412487691 to my MySQL database for use in the future, the MySQL type of data is a string
userid STRING NOT NULL,
However when I retrieve the data it outputs ...
0
votes
0
answers
16
views
Type mismatch when importing from Pandas to SQLAlchemy Declarative Class
The code actually works but big red flag as pyright detects a type mismatch.
When I import from a csv file to a Pandas dataframe and then instantiate
company = Company(name=df['name'][index],
...
0
votes
2
answers
93
views
Convert Time in hh:mm:ss Format to Total Minutes in pandas [duplicate]
I have the following sample input table below. The Time column is in the format of hh:mm:ss or hours, minutes, and seconds.
Name
Time
Jim
1:33:04
Chrissy
0:06:39
Billy
10:00:02
The code to ...
1
vote
1
answer
56
views
Prevent false date to string conversion [duplicate]
I'm new to AppScripts (JavaScript).
I want to automate an accounting sheet. I have a lot of account numbers and headings in column A. To only keep the account numbers I only want to keep the values ...
0
votes
0
answers
29
views
Jolt transformation from String to Double with formatting
Is there a way to format the Jolt transformation from string with "=toDouble" to have always one decimal?
I am trying to transform the following
Input:
{
"myValue": "1" ...
-7
votes
1
answer
99
views
how to enable narrowing conversion in function parameter
how to enable narrowing conversions in functions or constructors, that is you're allowed to pass types that require narrowing conversion, without the need to use static_cast explicitly
struct Position
...
2
votes
1
answer
81
views
Why do I need `std::type_identity_t` to enable implicit type conversion here?
#include <concepts>
#include <format>
#include <string_view>
#include <type_traits>
template <typename ... Args>
struct FmtString {
std::format_string<Args ...>...
-3
votes
0
answers
74
views
Error in Python - TypeError: 'str' object is not callable [duplicate]
I wrote the following code:
user = "Rohini"
lines = 100
print("Congratulations, " + user + "! You just wrote " + str(lines) + " lines of code")
But I got an ...
0
votes
1
answer
73
views
In python converting Datetime value to Number like excel
In excel if we convert datetime i.e. (10/21/2023 2:00:49 PM) into number we get (45220.583900463)
using Udemy i am learning Python so i have started a project for myself i even use GPT too if i am ...
0
votes
0
answers
15
views
Googles Protobuf without deserialization
Normally google protobuf or the nanopb implementation is intended to serialize/deserialize messages on the server respectively the client side.
However, I'm faced with a case where the serialization ...
-2
votes
1
answer
104
views
Trying to convert a column in SQL to simple duration (Column is like "3 Days 18 Hours 51 Minutes") [closed]
I have a column in SQL that has several fields in the format of "3 Days 18 Hours 51 Minutes." I was hoping someone could help change that duration into a plain number field like 5451 as the ...
1
vote
2
answers
34
views
Convert the names of numeric numpy arrays to a list in Python
I want to convert the names of numeric numpy arrays to a list. I'll use the list to feed a pandas column statement. Here is an example of what I want:
import numpy as np
#Data
a = [1, 2, 3]
b = [4, 5,...
-1
votes
0
answers
44
views
How do I get the results of a query with "for xml auto" specified
I have a T-SQL query with FOR XML AUTO specified in it. If I run the query in SQL Server Management Studio, the XML result appears as a single column in a single row.
I have executed the query using ...
0
votes
1
answer
127
views
Converting a byte array to a string and converting it back to byte array in same encoding producing different results
I'm generating a random 20 bytes long array and want to convert it to a string, in order to use it as a random token for an API call.
However when I convert it back to a byte array (just for testing), ...
0
votes
0
answers
16
views
ValueError: invalid syntax for integer with base 10 - Reading numbers from files in Micropython
I am building a matrix display using LED strips which are now working. As part of that in the full version of Python I have a program which reads an image and then saves the RGB values of the pixels ...
-1
votes
1
answer
66
views
PHP how to treat string as binary number
I wanted to find how to make the sum of 2 binary numbers.
Problem is they don't have the leading 0b prefix.
I can do this with bindec(), and back to binary with decbin(), but it looks really useless ...
4
votes
2
answers
118
views
Read image file
I have this picture of white and black squares. Each square represents a 0-Black and 1-White. Is there a way to scan the image from left to right and write the binary output to a .txt file? I need to ...
0
votes
0
answers
43
views
how to convert a negative numeric to postive in sql
I want to convert -2.07 to 207 but using ABS() as shown; it returns 200 not 207.
Please help me understand what I am missing here. Thanks.
declare @ReimbursementCents int,
@journey_fare numeric(7,2)
...
0
votes
0
answers
52
views
How does one programatically map object values in Zod?
For the following schema:
const z_BaseCustomer = z.object({
name: z.string(),
age: z.number()
});
const pizzas = [
{
value: "pn_pizza",
label: "Pineapple Pizza",
},...
2
votes
2
answers
106
views
Is there a failsafe way to determine the alignment/trailing bits of a pointer in C?
In C, a pointer is aligned to a certain if a certain number of trailing bits are zeros. This requires extracting the bits of a pointer, albeit only bounded number of trailing bits. The obvious way is ...
0
votes
1
answer
26
views
Convert the Sas mdy function to sql in yymmdd format
We are having a sas code which contain mdy function.i want to convert that function to sql in yymmdd format.
Can anyone help.
Sas code:
If day(&x.)<12 and month(&x.)=1 then call symputx('...
1
vote
1
answer
70
views
Use type_identity_t in a lambda argument
I'm trying to reimplement Logan Smith's implicit_cast from Cursed C++ Casts within an expression. My approach is to combine an anonymous function with type_identity_t:
#include <iostream>
using ...
2
votes
4
answers
96
views
Polars cast pl.Object to pl.Utf8: polars.exceptions.ComputeError: cannot cast 'Object' type
I got a pl.LazyFrame with a column of type Object that contains date representations, it also includes missing values (None).
In a first step I would like to convert the column from Object to Utf8 ...