Questions tagged [data-conversion]

This tag refers to the process of converting the data type of one piece of information into another type.

1963 questions
7
votes
4 answers

How to convert float to uint by float representation?

In C I will do this to convert float representation of number into DWORD. Take the value from the address and cast the content to DWORD. dwordVal = *(DWORD*)&floatVal; So for example 44.54321 will become 0x42322C3F. How can I do the same in C#?
Pablo
  • 28,133
  • 34
  • 125
  • 215
7
votes
1 answer

C# convert object[ ] into byte[ ], but how to keep byte object as byte?

I am using Convert an array of different value types to a byte array solution for my objects to byte array conversion. But I have a small issue that causes a big problem. There are "byte" type of data in mids of object[], I don't know how to keep…
Kai Mon
  • 75
  • 5
6
votes
3 answers

Expand a matrix of rankings (1 ~ 4) to a bigger binary matrix

I have a matrix which I want to convert to one with binary output (0 vs 1). The matrix to be converted contains four rows of rankings (1 to 4): mat1.data <- c(4, 3, 3, 3, 3, 2, 2, 1, 1, 1, 3, 4, 2, 4, 2, 3, 1, 3, 3,…
cliu
  • 933
  • 6
  • 13
6
votes
1 answer

Converted model from keras h5 to pytorch - fully connected layer mismatch

I have converted two models (vgg16 and resnet50) from Keras with TensorFlow backend (from as model.save file) into PyTorch using mmdnn. This was done with the following: mmconvert -sf keras -iw vgg.h5 -df pytorch -om keras_to_torch.pt A =…
JP1
  • 731
  • 1
  • 10
  • 27
6
votes
2 answers

Using a Data Converter to Display 3D Volume as Images

I would like to write a data converter tool. I need analyze the bitstream in a file to display the 2D cross-sections of a 3D volume. The dataset I am trying to view can be found here:…
Raiyan Chowdhury
  • 281
  • 2
  • 20
6
votes
4 answers

Convert a string to a big integer in Javascript?

I am trying to convert a string to a big integer to perform some arithmetic calculations. However, when I try this: Number("9007199254740993") ...I am getting this unexpected result: 9007199254740992 I suspect that this is probably because of the…
Vikram Kumar
  • 300
  • 2
  • 10
6
votes
1 answer

Convert Big Integer value to eight bit bytes(2s complement big endian) sequence which is multiple of 8 in Java

How to convert big integer to the following byte array form in Java: Big Integers are encoded as a sequence of eight-bit bytes, in two's complement notation, transmitted big-endian. If the length of the sequence is not a multiple of eight bytes,…
Vishnu
  • 479
  • 1
  • 3
  • 14
6
votes
2 answers

How to convert JSON data with dynamic element names into rows using pl/pgsql?

I need to get json from a restful service in a pl/pgsql function. (I have no control on restful webservice. It's published by someone else). I could get the json but I couldn't convert it to rows (for inserting to a table). The simplified format of…
Ugur Yorulmaz
  • 143
  • 1
  • 8
6
votes
4 answers

How to use papa-parse-angular2

Want to use papa-parse-angular2 to convert CSV to JSON. Didn't find any example so I do it like this. app.module.ts import {CSVService} from 'papa-parse-angular2'; @NgModule({ providers: [ CSVService, ... xx.component.ts constructor( private…
brewphone
  • 1,316
  • 4
  • 24
  • 32
6
votes
1 answer

How convert a JSON string to Dictionary in Python?

I already read different post regarding python conversion from str to dic but I still have problems and I can't convert my str in dictionary. this is my original string: {"faqId":1,"isPrivate":false,"question":"Question 1","answer":"# Hello…
Carlo 1585
  • 1,455
  • 1
  • 22
  • 40
6
votes
1 answer

Multiple y-axis conversion scales

Hi I'm trying to create plots which incorporate parallel conversion scales for two sets of units on the y-axis; using the two different styles of: offset ('parasitic') y-axes and overlaid/shared y-axes to replicate the style of the left-hand…
Dave
  • 515
  • 1
  • 8
  • 17
6
votes
1 answer

Receive UDP packet datagrams in PHP

I am working in php to build a listening server for a GPS tracking system. The GPS sends data through UDP packets, which I can display by running the below script. However the actual data comes out in symbols so I am guessing I am missing a…
dslauter
  • 75
  • 1
  • 3
  • 6
6
votes
1 answer

Invalid cast from 'System.Double' to 'System.Nullable`

I've the following function which was based on this inital Generic function to handle DataType Conversion public static T ConvertFromDB(object value) { return value == DBNull.Value ? default(T) : (T)Convert.ChangeType(value, typeof(T)); } It…
neildt
  • 5,101
  • 10
  • 56
  • 107
6
votes
1 answer

Converting Pixels to LatLng Coordinates

Hello Programming World, I am using the Google Maps API v3 and I have a map overlay that I need specific coordinates from. In the image, I've managed to convert the two pixel coordinate sets from the top left and bottom right into latitude and…
user1767177
6
votes
2 answers

How can I convert a string such as 5.7303333333e+02 to decimal in PowerShell?

I'm trying to convert strings such as 5.7303333333e+02 to the decimal type. I've tried using [decimal]::TryParse but the return value is false. Is there a method similar to [datetime]::parseexact, or any clean way to convert these strings? Or am I…
rtf
  • 724
  • 3
  • 15
  • 27