Questions tagged [converting]
Converting involves changing data from one data type or format to another.
378
questions
4
votes
3
answers
288
views
Mutual conversion operators
What is more readable? value / 60 / 60, value / 3600, or ...
4
votes
3
answers
210
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-...
4
votes
1
answer
87
views
Brainf**k to Ruby interpreter -- v3
Previous iteration.
I think this is about as good as it's gonna get, but just for kicks, let's do one more round of iterations.
As before, it's a very simple substitution from Brainfuck to Ruby, ...
4
votes
2
answers
5k
views
ConcurrentLinkedQueue to unmodifiable list
I have a ConcurrentLinkedQueue where I put some mails in. Now I have a visual page where I want to see what's in the Queue, but ...
4
votes
1
answer
5k
views
Binary to ASCII converter
This is a program I wrote to convert binary to ASCII. I am still learning ARM assembly. How can I improve my program? Are there any bad programming habits in my code?
I've tested it on Raspberry Pi ...
4
votes
1
answer
709
views
Converting an array-returning function to a lazy evaluator
Take a look at the following function:
...
4
votes
1
answer
1k
views
Program for importing autotask contracts into dynamics CRM 2011
We regularly have to convert a bunch of autotask Contracts to a custom CRM entity because we have employees who don't work in Autotask but need those contracts. I wrote the above code to handle this ...
4
votes
2
answers
2k
views
Roman numeral converter in Ruby
For a Project Euler problem, I made a Ruby roman numeral converter:
...
4
votes
1
answer
623
views
C++ String Conversions using Iconv
Since charset conversions is so darn badly implemented and most standard options are deprecated I recently wrote a wrapper around iconv that converts from system narrow / multibyte character set to ...
4
votes
1
answer
1k
views
Python 3 script to phonetically transliterate written English to Cyrillic and/or Greek
This is a Python 3 script I have written over three days that transliterates (not translating) English orthography written in Latin alphabet to the Cyrillic alphabet, the Greek alphabet or a mixed of ...
4
votes
2
answers
23k
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 ...
4
votes
1
answer
2k
views
Hex to Double converter
I stumbled on this SO question which was asking about a way to convert larger hex values to a positive numeric value:
...
4
votes
2
answers
223
views
Convert impute2 files to mach format
Here is a program for converting Impute2 files into MaCH format (related to genetics).
Source files include one xxx_haps file and one xxx_samples file, for example:
...
4
votes
2
answers
143
views
Numbers to Strings in Python part 2
After implementing most of the suggestions from the first question, This is the code I got:
...
4
votes
1
answer
9k
views
Conversion from postfix to infix in C
Just over half way through in K&R, came across an exercise to convert from postfix ("reverse-Polish") notation to infix (standard) notation.
Basically I'm posting here to see if there is ...
4
votes
1
answer
2k
views
Python converter: number-to-English - Project Euler 17
So I wrote this function to convert a given number to its interpretation in the English language as part of the Project Euler exercises. It works fine, but I sense that it's rather sloppy and ...
4
votes
3
answers
5k
views
Converting base-10 numbers into base-26 letters
I'm writing something that basically takes a bunch of files and renames them into a nice format, such as pic_000.jpeg, ...
4
votes
4
answers
2k
views
Temperature converter that seems to violate SRP
I've written this class for two purposes (I think only this fact shows that this code violates SRP): convert weight from one unit to another and to represent them accurate or not accurate. So class ...
4
votes
1
answer
2k
views
Converting a binary string to hexadecimal using Rust
Once again, I am reinventing the wheel here to understand the fundamentals of rust. In a previous question I requested feedback on my function that performed a hexadecimal to binary conversion. In ...
4
votes
2
answers
785
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 ...
4
votes
1
answer
759
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
1
answer
9k
views
Byte-to-binary conversion function
My implementation of a binary-to-bits converting function:
...
4
votes
1
answer
102
views
Motor degree movement function
I want to control a motor which rotates a device over a gear.
Input values for the device are from 0 to 360 degrees. The motor should always rotate the device the shorter way around. For example, if ...
4
votes
2
answers
2k
views
Converting English Measurements to Metric and vice versa
I finished answering Exercise 3.3.1 of How to Design Programs where:
Exercise 3.3.1. The United States uses the English system of
(length) measurements. The rest of the world uses the metric ...
4
votes
1
answer
96
views
Constructing constrained/validated objects
I'm trying to do some rudimentary DDD in validating my objects to ensure they are of a particular type. I.e. an Email object would always look like "[email protected]" ...
4
votes
2
answers
2k
views
Basic distance conversion program
This is a simple program to convert miles, yards, feet, and inches appropriately. Everything intended for works but I feel my program is very redundant. How can I make it more efficient and less lines ...
4
votes
1
answer
4k
views
Convert between two bases, each between 2 and 36
I'm doing some Python practice for fun and I wrote some code that converts between two bases. I'm thinking about expanding on this later, so the docstrings are pretty redundant from function to ...
4
votes
1
answer
5k
views
Converting float from arbitrary base to arbitrary base
I needed to write a small program to convert floats from any base to any other base. The thing is, it got big. I know there are other ways to implement the conversions (such as doing subtractions ...
4
votes
1
answer
185
views
Fahrenheit <=> Celsius converter in Rust
It's one of the tasks suggested in the Rust Programming Language book by Steve Klabnik and Carol Nichols, and to a complete Rust newbie like me, figuring out converting scale from ...
4
votes
1
answer
94
views
Get local datetime from UTC time
One of the app is inserting date in UTC format (column CreateDate). When reporting from this table, I used a difference in hours between the inbuilt ...
4
votes
1
answer
291
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 ...
4
votes
2
answers
7k
views
Java Temperature Converter GUI
Today is my first time working with GUI, so I'm really interested in the best ways of handling various events to get the best habits from the jump. Most of the GUI-related code for this project was ...
4
votes
1
answer
1k
views
Convert tree to circular doubly linked list
I want you to pick my code apart and give me some feedback on how I could make it better or simpler. This code converts a binary tree to a doubly linked list (in order).
...
4
votes
1
answer
7k
views
Unit Converter App
Please review this Android UnitConverter App which has been designed using Strategy Pattern.
...
4
votes
0
answers
57
views
Translating Python to Rust: reading a Salesforce ID from a string
As a first project in Rust, I'm translating an existing, working piece of Python code. This code's purpose is to convert a 15-character Salesforce Id (which is guaranteed to be ASCII, exactly 15 bytes ...
4
votes
0
answers
154
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 ...
4
votes
0
answers
761
views
Parsing an infix notation expression and converting to reverse polish notation
I'm pretty new to Go, and I do not know the best or idiomatic ways to do most of the stuff, so I'd appreciate feedback on how to make my code better, faster or more idiomatic.
My program is a set of ...
3
votes
3
answers
9k
views
Best C# idiom to convert the items on an object array to a string?
I have something akin to
...
3
votes
4
answers
772
views
Convert number 1-5 from its spelt-out form
I'm working with an API that for some strange reason returns star ratings as words, like FIVE,FOUR,THREE,TWO,ONE. As far as I can see, there's no way to just get ...
3
votes
2
answers
5k
views
Converting numbers to English words
This is a simple program to convert a number, from 0 up to 99999999, to English words.
Example:
If the input is:
1234
The output would be:
one thousand two ...
3
votes
4
answers
6k
views
Binary/decimal/hex converter using Tkinter
I debated long and hard before posting this question, and I did a lot of experimenting. I just can't seem to work out an 'elegant', concise way to get done what I want done in the manner I want it ...
3
votes
2
answers
1k
views
Integer to English Conversion
I wrote some code to translate numbers ( for now just positive, up to the 32bit limit ) into English words.
Everything works and I'm happy. I searched through the site looking for a comparison code ...
3
votes
4
answers
7k
views
Temperature conversion program with a lot of repetition
My son (9) is learning Python and wrote this temperature conversion program. He can see that there is a lot of repetition in it and would like to get feedback on ways to make it shorter.
...
3
votes
2
answers
271
views
3
votes
2
answers
286
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 ...
3
votes
2
answers
3k
views
Currency conversion class with caching
I've just made this class, which supports caching. I'd really appreciate any comments on how to make it better etc.
Code
...
3
votes
2
answers
129
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 ...
3
votes
1
answer
97
views
Map strings to (const) ints
I'm imagining go generate would be a good tool for this. I want to convert strings to ints to save space.
...
3
votes
3
answers
2k
views
Hexadecimal to string without C++ standard library functions
For the purposes of this code review, I will use the standard library, but pretend that <cstddef> is <stddef.h>, ...
3
votes
1
answer
166
views
An up-cast for C++
Usually in C++, the language rules automatically widen types as necessary. For example, I can pass a pointer-to-derived in place of a pointer-to-base, and the same with references.
There are ...