Skip to main content
1 vote
2 answers
220 views

Consider the following example: struct DefaultSettings { std::string tcpIpAddress = "127.0.0.1"; uint16_t tcpPort = 1993; // Marked as magic number! } clang-tidy (with readability-magic-...
boris blokland's user avatar
4 votes
3 answers
174 views

I know the following code violates strict aliasing rules int object = 10; int *pi = &object; // OK float *pf = (float *)pi; // OK float f = *pf; // undefined behavior In the header files of ...
Evgeny Ilyin's user avatar
1 vote
1 answer
325 views

I see the magic number 0xa282ead8 in many CRC implementations, like https://github.com/kubo/snzip/blob/master/crc32.h I don't understand CRC calculation very well. What's the effect of this number and ...
can.'s user avatar
  • 2,289
0 votes
3 answers
410 views

Abstractly, say you were building a physics simulation and needed many universal constants or typical values for things like mass. It feels like there should be a standard approach to implementing ...
Tess's user avatar
  • 3
3 votes
2 answers
1k views

Consider the following code: const double Motor_Kv = 1.1e5; // Motor constant, [rpm/V] const double Motor_R = 2e-2; // Winding resistance, [Ohm] const double Motor_J = 3e-6; // Rotor angular mass, ...
Dmitry Grigoryev's user avatar
1 vote
0 answers
1k views

I have compiled this visible_code.py file into .pyc compiled byte code file, then I am running the function fun from .pyc file. # visible_code.py def fun(): print("Hello") # convet to ...
Visrut's user avatar
  • 762
0 votes
1 answer
154 views

I'm testing to ensure a Buffer's magic number is zip format. I'm doing this by extracting the buffer's first 4 bytes to string and comparing against the magic number for zip which is PK. const ...
alyx's user avatar
  • 2,743
0 votes
1 answer
42 views

So I want to specify a time after which a post gets deleted. The time is 3 months, in my code I would define this as const THREE_MONTHS_IN_MS = 7889400000 export const ...
CaitlynCodr's user avatar
0 votes
0 answers
319 views

I have done some checks for the fast inverse square root method in python (jupyterlab using python version 3.8.8) and for some reason then I've come to the conclusion that I must either be doing ...
Henrik's user avatar
  • 21
0 votes
1 answer
1k views

I use magic numbers in class member initialization: private static final RangeMap<Integer, String> MY_MAP = new ImmutableRangeMap.Builder<Integer, String>() .put(Range.closed(10, ...
Michal Špondr's user avatar
0 votes
0 answers
191 views

I'm doing an exercise: write a C program for Linux that searches for files in ELF, PE32, COFF and a.out formats using the magic number of the file header. I tried writing my own program to find magic ...
Ivan Ivan's user avatar
2 votes
1 answer
2k views

I want to get the Magic Number from a binary file (for example file ELF hava 7f 45 4c 46). I wrote a program to print out the magic number of the file but i get the error zsh: segmentation fault ./...
Ivan Ivan's user avatar
1 vote
0 answers
51 views

Suppose we a validation code similar to the following: Rule(account => account.CompanyName).MaxLength(50) Or Rule(account => account.Balance).MustBeGreaterThan(0) Do we still call the numbers ...
Kush Grover's user avatar
6 votes
2 answers
7k views

By entering the file with its extension, my code succeeds to detect the type of the file from the "magic number". magic_numbers = {'png': bytes([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, ...
Alya Mad's user avatar
1 vote
1 answer
1k views

I'm using file_picker to choose file from storage and sometimes it doesn't give an extension but I need to know an extension to send it to server side. I'm going to identify it by Magic Number like ...
Zhu's user avatar
  • 417

15 30 50 per page
1
2 3 4 5
13