Converting involves changing data from one data type or format to another.
1
vote
1answer
59 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 ...
8
votes
1answer
174 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
41 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
79 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, ...
-1
votes
1answer
36 views
Construct: bytes and bits conversion
This code is part of Construct library that converts between byte and bit representations.
...
3
votes
1answer
55 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
261 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
28 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
41 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
64 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
91 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
149 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
84 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 ...
4
votes
4answers
2k 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 ...
3
votes
2answers
76 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
76 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
215 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
118 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
404 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 ...
-6
votes
1answer
84 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
38 views
Handler for bidirectional unit conversion form
Building a form where values can be entered in either pounds or kilos.
Script is...
...
11
votes
6answers
875 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 ...
2
votes
2answers
645 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 ...
6
votes
4answers
2k 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
3k views
Currency converter in Python [closed]
I am looking for some ways to make my code simpler for this currency converter.
...
3
votes
2answers
3k 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
467 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
63 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
563 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
493 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 ...
1
vote
1answer
77 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 ...
1
vote
1answer
74 views
Filter to convert duration to hours — in controller or model?
I have this before_action method :
...
3
votes
2answers
1k 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
2answers
404 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
1answer
274 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:
...
12
votes
1answer
3k views
Roman Numerals in Java
I wrote a class that can convert to and fro from Roman Numerals and Decimals. I would appreciate critical points on everything, especially:
Shortening my code.
Choosing a better approach.
Using ...
7
votes
5answers
2k views
Creating a numeric phone keypad
I'm writing a Telephone class and it has a method called getDigits which takes in a String parameter and returns the number that would appear on your phone if you ...
7
votes
1answer
985 views
Replacement string Base64 (and a Base32) conversion [closed]
This provides (my own) implementation of ToBase64String and FromBase64String (since the .NET implementations suck), and a ...
6
votes
5answers
507 views
Using functions to separate code for Fahrenheit to celsius conversion
I'm relatively new to programming, and I've been wondering about a problem such as this. How can I think about decomposing the code into its constituent functions? I went the simplest route I could, ...
6
votes
2answers
137 views
Number converter between bases
I just wrote a utility program in C that converts numbers of different bases to 'standard' well-known bases (hex, dec, oct, bin). I called it repnum, short for "...
9
votes
3answers
208 views
HTML to Markdown converter
I've made a simple HTML→Markdown converter in Javascript and am looking for any feedback. For now, I've basically used Stack Exchange's /editing-help as a guide as ...
4
votes
1answer
385 views
GUID to hex-string and back
I'm new to Python and I'm trying to convert between Microsoft GUIDs and plain hex strings:
...
3
votes
3answers
2k views
Unit Converter in Python
I am new to programming and I am trying to make a simple unit converter in python. I want to convert units within the metric system and metric to imperial and vice-versa. I have started with this code ...
3
votes
1answer
53 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.
...
1
vote
1answer
2k views
Powershell to Convert HTML Table to Array of PSCustomObject
I created the below script to sent a request to a website, then convert the table in the results to an array of PSObjects which I can work with in PowerShell. This uses some nasty hacks (e.g. using a ...
3
votes
2answers
2k views
Currency converter using MVC pattern in C++ & QT
While understanding the MVC pattern, I came across this particular article. I thought to implement it using the C++/QT library.
The intent over here is to implement/use MVC concepts in correct way. ...
3
votes
2answers
1k 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 ...
13
votes
2answers
3k views
Convert Persian digits to English numbers
I use the following code to convert ۱۲۳۴۵ to 12345, effectively transliterating the persian numbers into latin numbers:
...
3
votes
2answers
184 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 ...
6
votes
4answers
240 views
Converting from decimal to word
I'm still investigating the problem with decimal to word conversion. I understood the basics, but now my goal is to learn how to add in base-26 (the English alphabet) or base-52 (...