Questions tagged [converting]

Converting involves changing data from one data type or format to another.

Filter by
Sorted by
Tagged with
2
votes
1answer
59 views

Static Methods for Dealing with Conversions from and to UTC

I asked this question over at stackoverflow but was told it may be better suited here. So I absolutely want to store DateTimeOffset objects in UTC format. To ...
3
votes
2answers
32 views

Excel To CSV Converter Ch 9 ATBS

I am learning more about python using the book "Automate The Boring Stuff". The problem I completed was "Excel To CSV Converter". I want to kick bad habits to the curb, and make sure I'm learning the ...
6
votes
2answers
182 views

Internal and external datatype converter

One of the big problems I have is cleanly converting from an internal datatype to an external datatype. We can all do it the not so clean way, however I think this add too much mess. I can use ...
3
votes
1answer
280 views

Convert *.VCF contact file for cellphone import

My new mobile phone is capable of importing contact information from a renamed *.VCF file stored on an SD memory card (https://www.quora.com/How-do-I-sync-contacts-on-Nokia-130). Annoyingly, it does ...
2
votes
0answers
48 views

String to long double conversion using FBLD

I always wanted to try fbld x87 instruction to aid to convert string to floating point value. I sure a chance to face this instruction in disassembly of all the ...
4
votes
2answers
439 views

Convert data frame to list of lists by row

I am rewriting some old code where I take a dataframe in r and convert it using the tidyverse packages to a list of lists, where ...
2
votes
4answers
111 views

Taking 2 command line inputs and verifying that they are integers, within the correct range of values

I'm taking 2 command line inputs, which have to be integers between 2 and 1,000,000. These two values are then passed into the getPrimes function, which is just a ...
2
votes
0answers
79 views

Converting between bases (2 to 221) with optional seeds and padding

It's been a while since I had a bit of fun getting something useless working, so I thought I might as well ask if there's anything to improve about how I do things. The original idea was to convert <...
3
votes
1answer
4k views

Generate JSON File from a given YAML file

I'm didn't use java for a long time(5 years ± ) and in the following code the user should provide yaml file and it converting it to json file. The code is working as expected but since I didn't use ...
4
votes
1answer
562 views

constexpr Endian conversion in c++14

This is my take for constexpr big / little endian conversions. The code supports only little and big endian; mixed endian such PDP is not supported. ...
8
votes
2answers
2k views

Convert mixed-format phone numbers to pure numbers

I am just getting started with C# and wanted to make sure that I am aware of any errors/inefficiencies in my code. For this specific project, I wanted to prove to someone that a "bot" could easily ...
2
votes
0answers
342 views

Convert FoxPro/dBase DATETIME field to Win32 SYSTEMTIME struct

I'm trying to write a complete driver for Visual FoxPro's DBF format for Win32. I found that the way that fields of the DATETIME type are stored in dBase files is ...
4
votes
3answers
244 views

Converting from decimals to roman numerals

I've submitted the following code for a job interview, and I wanna know if there is anything I can improve on it, or better ways to do the same thing. ...
4
votes
1answer
148 views

Extending COERCE to other reasonable object type conversions

It's a basic principle in AI that different problem representations can either facilitate or impede a solution. Being able to readily switch data representations while programming in Common Lisp may ...
2
votes
0answers
86 views

ByteUnit class to convert across size units

Based on java.util.concurrent.TimeUnit class I wrote similar class to convert size units: ...
1
vote
1answer
2k views

Hex-string representation of a byte array [closed]

I have a legacy method toHex(byte[]) used in my application since the beginning of time to store a hexadecimal representation of a ...
0
votes
2answers
12k views

Interpret YYYYMMDD as the nth day of the year [closed]

I am provided a bunch of dates in the format (YYYYMMDD) such as: date='20170503' My goal is to convert that date into the ...
5
votes
2answers
2k views

Using generic types for a custom mapper

I have a method which takes a certain generic object, which basically orders these objects based on a list of tags. Because I want to use this method for multiple objects, I have created a class which ...
4
votes
3answers
174 views

Setting Entity Framework up for success

So I am working on an application (top-secret!) that I need settings for, these settings are pretty basic, but I don't want to make a single-row table with a bunch of serialized settings, or a single-...
1
vote
1answer
500 views

C++ conversion from std::string to arithmetic type using std::locale::classic()

I recently had a bug where extracting a decimal from a string failed due to locale settings. That is, some locales use a , as a decimal point, rather than a ...
11
votes
2answers
507 views

A Binary Editor with Live Text Preview

This is a tool I needed for some other things (it's incomplete, but almost done) which is essentially just a text-editor that has two text-boxes: the left being the binary view / raw bytes, the right ...
2
votes
0answers
711 views

Converting [UInt32] -> [UInt8] -> [[UInt8]]

I am trying to speed up my current implementation of a function that converts [UInt32] to a [UInt8] which in turn is split up ...
2
votes
2answers
177 views

Pronounceable binary-to-text encoding

This is a binary-to-text encoder that is based on Base64, but it works by converting data into an almost pronounceable string (consonant-vowel-consonant-vowel for each 3 bytes). Any improvements, ...
0
votes
1answer
2k views

Construct: bytes and bits conversion

This code is part of Construct library that converts between byte and bit representations. ...
3
votes
1answer
72 views

Map object types using custom converter

I'm trying to design a mapper that will convert one object type to another shown in the diagram below: The object has structure as follows (it's not a JSON): ...
3
votes
1answer
14k views

Convert an image to 8-bit color

I have a function that will take an image and then return that image in 8-bit color. Almost all of the code was taken from MSDN. The code is quite short compared to all of the other methods I've seen ...
0
votes
1answer
158 views

Generic Int conversion to scalar

I'm new to Scala and I'm trying to write a generic function to convert from Int to any scalar. For example: ...
4
votes
0answers
95 views

Blender exporter for Unreal Engine 1 brushes

Unreal Engine 1 nowadays is slightly useless, but it still is (kinda) flexible and allows for modifications of extensive kinds, including many sorts of maps. However, one of it's editor, Unreal ...
2
votes
2answers
757 views

Converting XML to DOT

I would like to show an XML tree as a tree using GraphViz Dot tool. Then I must convert it to a DOT file. It is what I have tried ...
5
votes
1answer
3k views

Find a value in a comma delimited String

Here is a simple WPF converter method designed, where the object is a string, and the parameters are a string, which contain a set of comma separated values. The program return true if the list has ...
1
vote
2answers
680 views

C++ XOR Function

This XOR function is costing my program too much time (specifically the conversions.) How can this code be made faster? ...
5
votes
2answers
766 views

Time conversion program optimization

I have just finished working on a problem on hackerrank dealing with time conversion in C++. I'm still fairly new to programming as I only have a few semesters of programming classes under my belt ...
8
votes
4answers
31k views

Converting the DateTime to and from Unix epoch times

I'm currently working on a thing I needed this feature for. Essentially, these are two methods to convert DateTime objects to and from the Unix epoch time (two ...
2
votes
2answers
123 views

Decorator to convert a function's result into the desired units

I tried to collect some of my formulas inside classes so that I didn't need to browser the names of the functions anymore but only determine which Quantity I want to calculate and then check which ...
1
vote
1answer
153 views

Grabs 10 bytes and converts it into a hex formatted string

I'm working on some code right now where the goal is to take in a byte stream and grab the data from the body of a message. The data is 10 bytes long and is meant to be translated into hex. ...
3
votes
2answers
664 views

Python script converts after effects clipboard keyframe data to nuke keyframe data

This is my first 'proper' script since learning python and I'd love it if I could get some feedback on things I've done wrong / things I can improve on. The script takes clipboard data from after ...
1
vote
1answer
123 views

Character-to-string converter

I created a program that will convert a 3-character combo into a 3-string combo. I used a lot of if statements to accomplish the conversion. I'm wondering if there ...
5
votes
1answer
2k views

Creating PDF files from a ODT template

The code is actually a TemplateBuilder. We have 2 different templates, French and Dutch. We need to change the template and then convert it to PDF so it can be stored in the DB later. The main method ...
-7
votes
1answer
112 views

Python to Ruby: inconsistency with float ceil() [closed]

Just for fun, I am trying to convert the following Python from math import * print map(lambda count: ceil( 6 * cos((count + i) * pi / 5) ), range(100)) Which ...
2
votes
1answer
43 views

Handler for bidirectional unit conversion form

Building a form where values can be entered in either pounds or kilos. Script is... ...
12
votes
6answers
6k views

Converting strings to PascalCase

I have a method which I use on occasion to convert strings (like enum and property names) to PascalCase for display. It's ...
3
votes
2answers
7k views

Parsing from one enum to another

I face a problem I think I am not approaching appropiately. I have two independent enumerators that both will contain the same members, the only difference being the values given. I have to be able ...
10
votes
6answers
16k views

12 hours to 24 hours conversion function

I have made a time format converter which converts 12 hour format to 24 hour format. My convert_to_24() takes a string in format of ...
0
votes
2answers
26k views

Currency converter in Python [closed]

I am looking for some ways to make my code simpler for this currency converter. ...
5
votes
2answers
18k views

Converting a 12 hour time string to a 24 hour time string

Input - Standard input - HH:MM:SS[AM|PM] format. Examples: 12:00:00AM 12:00:00PM 01:00:10AM 01:00:10PM The program reads one line per instance. Output - military format (24 hour format): 00:00:00 ...
10
votes
3answers
1k views

Binary Converting Code

I made a program that converts a decimal number given from the user, and converts it to a binary number. For example, if I entered 2, it would return 10. It then, counts the amount of ones and zeros ...
3
votes
2answers
104 views

Convert hex encoded string to byte array

The following should read a hex string such as "ece998a2fb" into vector 236 233 152 162 251. I was unable to find any built in ...
5
votes
1answer
2k views

Converting IP Addresses to minimal binary formats

Once more, I come to you for assistance! I have written a significant bit of code that converts IP Addresses from strings to minimal byte-arrays. (So that you can store them in a binary format instead ...
2
votes
1answer
5k views

Convert string to integer or default

I need my string-to-int converter to handle all exceptions without throwing any errors. I also have a use case where I need the default value to be less than zero if the ...
2
votes
1answer
172 views

Celsius and Fahrenheit Converter

I'm very new to programming in C and I attempted to make a program that converts temperatures to and from Fahrenheit and Celsius. I have been running the program and I have realized that not all ...