Questions tagged [converting]
Converting involves changing data from one data type or format to another.
377 questions
6
votes
1
answer
317
views
Arbitrary-layout Floating-point Number conversion library
This is a library I've been writing, for now named ALFPN, for converting between native floats and layouts that are not native - half, various 8-bit formats etc. ...
4
votes
1
answer
153
views
Replacement for 'enum class' with string functionality
Because I think maintainability can be done better with strings instead of plain enumerator-values when doing fstream IO, I wanted a replacement struct in my project that behaves like an ...
2
votes
0
answers
165
views
PHP Parser and converter - SOLID and DRY
I am working on a PHP application that transforms data from the input CSV (JSON, TXT, or XML) into an output CSV (JSON or database, for example).
The output format differs from the input: some columns ...
8
votes
1
answer
774
views
library for converting numbers to HEX
This is library for fast converting "HEX strings" to unsigned numbers and vice versa.
The result is not defined, if input is incorrect, e.g. string "ZZZ1" will be converted to ...
3
votes
1
answer
70
views
How better methods of remaking the code by array without changing its functionality, and performance but reducing amount by ~10 times
Can anybody help me with examples of code?
How is the approach to optimize code relative to my example with using "switch case" to "arrays"? Without changing its functionality, but ...
0
votes
1
answer
297
views
WordPress Plugin for WebP/AVIF Image Conversion
I'm looking for feedback on a WordPress plugin I developed for automatically converting images to WebP and AVIF formats. The goal is to optimize image loading performance.
The plugin has the following ...
1
vote
1
answer
110
views
safe numeric type converter
I have written a function for casting between built in numeric types. I built it to check if the source value is within the range of the destination value, and to provide a nicely legible error if not....
1
vote
1
answer
307
views
C++ arbitrary base convertor
This is my second C++ program. Again, I wrote it all by myself. I only started learning C++ yesterday.
The concept of the program is simple; it should read input from ...
4
votes
2
answers
499
views
fast convert string_view to floating point
The code makes following assumptions:
std::string_view is not null-terminated
there are no exponents, all floating point inputs are in the way 123.123
limiting ...
1
vote
0
answers
92
views
Python script that turns a gigantic text file into an IP geolocation database
I have written a Python script that turns a gigantic text file into a SQLite3 database.
The text file is truly gigantic, it is 133MiB or 140,371,572 bytes in size, and contains 140,371,572 characters ...
5
votes
1
answer
723
views
Python script that identifies the country code of a given IP address
This is a Python script I wrote to identify the country code of a given IP address, using data obtained from tor.
It uses geoip.txt to identify country code for IPv4 addresses, and geoip6.txt to do so ...
5
votes
1
answer
2k
views
Convert bool to int and int to bool
I'm a noob.
I wrote this code to convert bools to ints and ints to bools as a past-time but I would like to know whether to continue programming - this is the kind of thing I've been doing, no useful ...
4
votes
1
answer
229
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 ...
6
votes
1
answer
234
views
General bytes to number converter (c++)
I've written a bytes to number converter for cpp similar to the python int.from_bytes.
It does not make any assumptions on:
The endianness of the input buffer
The ...
2
votes
2
answers
2k
views
Mapping pandas' Series to dataclasses
I've got something really simple this time where I'm mapping pandas' Series to dataclasses with a oneliner helper function (as ...