Windows error 0x7FFFFFFF, 2147483647

Detailed Error Information

HRESULT analysis[1]

FlagsSeveritySuccess

This code indicates success, rather than an error. This may not be the correct interpretation of this code, or possibly the program is handling errors incorrectly.

Reserved (R)true
OriginCustomer

This code was defined by a third party software company, and may mean different things for different software. Contact the software author for more information about this error.

NTSTATUStrue
Reserved (X)true
FacilityCode4095 (0xfff)
Error Code65535 (0xffff)

Questions

124votes
4answers

Why does rand() repeat numbers far more often on Linux than Mac?

I was implementing a hashmap in C as part of a project I'm working on and using random inserts to test it. I noticed that rand() on Linux seems to repeat numbers far more often than on Mac. RAND_MAX is 2147483647/0x7FFFFFFF on both platforms. I've reduced it to this test [...] read more
c
linux
macos
random
111votes
2answers

Google Authenticator implementation in Python

I am trying to use one-time passwords that can be generated using Google Authenticator application. WHAT GOOGLE AUTHENTICATOR DOES Basically, Google Authenticator implements two types of passwords: * HOTP - HMAC-based One-Time Password, which means the password is changed with each call, in compliance to RFC4226, and * TOTP - [...] read more
python
security
authentication
one-time-password
google-authenticator
91votes
5answers

Signed/unsigned comparisons

I'm trying to understand why the following code doesn't issue a warning at the indicated place. //from limits.h #define UINT_MAX 0xffffffff /* maximum unsigned int value */ #define INT_MAX 2147483647 /* maximum (signed) int value */ /* = 0x7fffffff */ int a = INT_MAX; //_int64 a = INT_MAX; // makes [...] read more
c++
visual-studio-2005
comparison
unsigned
signed
16votes
1answer

Generate a 10-digit TOTP password with a certain key

This problem is related to TOTP as specified in RFC6238 here: https://tools.ietf.org/html/rfc6238#section-1.2. I am to implement the RFC6238 to generate a 10-digit TOTP password, which will be used in a POST request later on. The sample input and output for the TOTP is supposed to be like this: Sample Input: [...] read more
java
encryption
hmac
password-encryption
one-time-password
14votes
2answers

How do I Mimic Number.intBitsToFloat() in C#?

I have been going crazy trying to read a binary file that was written using a Java program (I am porting a Java library to C# and want to maintain compatibility with the Java version). JAVA LIBRARY The author of the component chose to use a float along with multiplication [...] read more
c#
.net
binaryfiles
12votes
2answers

write a hexadecimal integer literal equal to Int.MIN_VALUE in Kotlin

how does one write a hexadecimal integer literal that is equal to Int.MIN_VALUE (which is -2147483648 in decimal) in Kotlin? AFAIK, an Int is 4 bytes...and sometimes it seems like 2's complement is used to represent integers...but I'm not sure. I've tried the following hex literals to help myself understand [...] read more
integer
hex
kotlin
12votes
3answers

Java Integer.MAX_VALUE vs Kotlin Int.MAX_VALUE

I noticed, one interesting thing. Java's Integer.MAX_VALUE is 0x7fffffff (2147483647) Kotlin's Int.MAX_VALUE is 2147483647 but if you write in Java: int value = 0xFFFFFFFF; //everything is fine (but printed value is '-1') in Kotlin: val value: Int = 0xFFFFFFFF //You get exception The integer literal does not conform to the [...] read more
java
kotlin
11votes
3answers

"Simulate" a 32-bit integer overflow in JavaScript

JavaScript can handle the following Math just fine: var result = (20000000 * 48271) % 0x7FFFFFFF; But in some programming languages, that first int*int multiplication results in a value too large to hold in a standard 32 bit integer. Is there any way to "simulate" this in JavaScript, and see [...] read more
javascript
integer-overflow
10votes
7answers

What is the value of ~0 in C?

I want to get the values of INT_MIN and INT_MAX. I've tried ~0 and ~0 >> 1 since the leftmost bit is a sign bit but I got -1 for both of them. It's so confused that why ~0 doesn't turn out to be 0xffffffff and ~0 >> 1 to [...] read more
c
bit-manipulation
9votes
3answers

Float32 to Float16

Can someone explain to me how I convert a 32-bit floating point value to a 16-bit floating point value? (s = sign e = exponent and m = mantissa) If 32-bit float is 1s7e24m And 16-bit float is 1s5e10m Then is it as simple as doing? int fltInt32; short fltInt16; [...] read more
c
floating-point
9votes
2answers

Javascript function rewritten in Java gives different results

There is this Javascript function that I'm trying to rewrite in Java: function normalizeHash(encondindRound2) { if (encondindRound2 < 0) { encondindRound2 = (encondindRound2 & 0x7fffffff) + 0x80000000; } return encondindRound2 % 1E6; } My Java adaptation: public long normalizeHash(long encondindRound2) { if (encondindRound2 < 0) { encondindRound2 = (((int) encondindRound2) [...] read more
javascript
java
8votes
4answers

spring.data.rest.max-page-size does not seem to be working

Under Spring Boot 1.3.0.M5 I'm using spring.data.rest.max-page-size=10 in application.properties. But I still can set the size to 40 in a URL and get a correct response. For example : http://localhost:8080/cine20-spring/api/films?page=0&size=40&sort=title,asc will give me back 40 films So what is the use of this parameter ? Update test with Spring-Boot 1.4.2 [...] read more
spring-data-rest
8votes
2answers

Sum of Two Integers without using "+" operator in python

Need some help understanding python solutions of leetcode 371. "Sum of Two Integers". I found https://discuss.leetcode.com/topic/49900/python-solution/2 is the most voted python solution, but I am having problem understand it. * How to understand the usage of "% MASK" and why "MASK = 0x100000000"? * How to understand "~((a % MIN_INT) [...] read more
python
7votes
4answers

Maximum Product of Three Numbers

I am trying to solve this problem from leetcode, going to copy here for convenience Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24 Note: The length of the given array [...] read more
python
algorithm
python-2.7
5votes
0answers

Is 32 bit comparison faster than 64 bit comparison?

Is the comparison of 32 bits faster than the comparison of 64 bits? I was looking at this file http://www.netlib.org/fdlibm/s_cos.c They have this piece of code /* |x| ~< pi/4 */ ix &= 0x7fffffff; if(ix <= 0x3fe921fb) return __kernel_cos(x,z); I understand the first line, which calculates the absolute value of [...] read more
c
5votes
0answers

Assembly enter protected mode and jump back to real mode

I am developing a toy OS in assembly and I have a problem when switching from protected mode back to real mode. I have successfully switched to protected mode, called the kernel that writes text to [0xb8000] video memory, returned to the caller and (probably) switched back to real mode. [...] read more
assembly
kernel
nasm
x86-16
bootloader
4votes
1answer

Trigger a test failure when UBSAN (-fsanitize=undefined) finds undefined behaviour

I have a small unit test here which has undefined behaviour. Source code: #include <gtest/gtest.h> TEST(test, test) { int k = 0x7fffffff; k += 1; // cause integer overflow } GTEST_API_ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } I enable UBSAN in my CMakeLists.txt: cmake_minimum_required (VERSION [...] read more
c++
ubsan
4votes
2answers

32 bit signed integer division gives 0x7fffffff as quotient on PowerPC

I am debugging a production code written in C and its simplest form can be shown as - void test_fun(int sr) { int hr = 0; #define ME 65535 #define SE 256 sr = sr/SE; <-- This should yield 0 if(sr == 1) hr = ME; else hr = (ME+1)/sr; [...] read more
c
integer-division
divide-by-zero
integer-arithmetic
powerpc
4votes
2answers

Why is gcc-multilib output incorrect for bitwise operation?

bug.c #include <stdio.h> int main() { int x = 0x7fffffff; printf("%x\n", x); printf("%x\n", ~x); printf("%x\n", ~x + ~x); printf("%x\n", !(~x + ~x)); } I compile using gcc -m32 bug.c -o bug This outputs: 7fffffff 80000000 0 0 It should output 7fffffff 80000000 0 1 I am using gcc 9.3 and [...] read more
c
gcc
bit-manipulation
undefined-behavior
integer-overflow
4votes
1answer

Speeding up modulo operations in CPython

This is a Park-Miller pseudo-random number generator: def gen1(a=783): while True: a = (a * 48271) % 0x7fffffff yield a The 783 is just an arbitrary seed. The 48271 is the coefficient recommended by Park and Miller in the original paper (PDF: Park, Stephen K.; Miller, Keith W. (1988). "Random [...] read more
python
numpy
optimization
ctypes
lcg
4votes
2answers

Custom linear congruential generator in JavaScript

I am trying to create a custom linear congruential generator (LCQ) in JavaScript (the one used in glibc). Its properties as it's stated on Wikipedia are: m=2^31 , a=1103515245 , c=12345. Now I am getting next seed value with x = (1103515245 * x + 12345) % 0x80000000 ; // [...] read more
javascript
canvas
random
functional-testing
lcg
4votes
0answers

I am trying to make an HTTP post, but json returns "message":"Unauthorized"

import httplib2 import hmac import hashlib import time import sys import struct import json root = "https://api.challenge.hennge.com/challenges/003" content_type = "application/json" userid = "toufiqurrahman45@gmail.com" name = "HENNGECHALLENGE003" shared_secret = userid+name timestep = 30 T0 = 0 def HOTP(K, C, digits=10): K_bytes = str.encode(K) C_bytes = struct.pack(">Q", C) hmac_sha512 = hmac.new(key = [...] read more
python
json
api
4votes
1answer

How can I diagnose and resolve a crash on WCSession sendMessage(_:replyHandler:errorHandler:)?

I'm building a watchOS app that needs to periodically request information from a companion iPhone app to refresh a complication. To achieve this, I have a WKApplicationRefreshBackgroundTask that runs periodically. It uses sendMessage(_:replyHandler:errorHandler:) from WatchConnectivity to request the information from the iPhone app, process the reply, and update the complication. [...] read more
ios
watchkit
watchos
watchconnectivity
wcsession
4votes
2answers

How do I prevent ld from adding .note.gnu.property?

I've got a toy x86 assembly program that I'm writing and compiling with as and ld: .text .global _start _start: movq $1, %rax movq $0x7FFFFFFF, %rbx L1: cmp %rbx, %rax je L2 addq $1, %rax jmp L1 L2: movq %rax, %rbx movq $1, %rax int $0x80 And then to build: [...] read more
ld
3votes
3answers

qemu-img: Could not open $FILE

I received a single-file VMDK from a vendor that has a virtual appliance for a particular product I'm interested in evaluating. We run a KVM solution (Proxmox) so I tried converting the file but on that system qemu-img blows up. (I was able to convert (multipart) VMDK files from bitnami [...] read more
kvm-virtualization
vmware-vsphere
qemu
vmware-vmdk
3votes
2answers

Why is an int variable valued `0xffffffff` >> 1 != 0x7fffffff?

int c = 0xffffffff; printf("%x\n", (c) == (0xffffffff)); printf("%x\n", (c >> 1) == (0xffffffff >> 1)); The first output is 1 but the second output is 0. And c >> 1 outputs 0xffffffff. But why? read more
c
3votes
0answers

Why is calling snprintf() so slow?

Our internal program is written in C makes extensive use of snprintf() for many piece, and I noticed that during debugging with perf record/report, it's spending a lot of time on the following: │ _IO_vfprintf_internal(): ▒ │ mov -0x510(%rbp),%rdx ▒ │ mov %r12,%rsi ▒ │ mov %r15,%rdi ▒ │ → [...] read more
c
performance
assembly
gcc
x86
3votes
2answers

A weird question for Tmax(0x7fffffff), why (!x) == x?

#include <stdio.h> void show_case(int x) { printf("x + x + 2 = %d\n", x + x + 2); printf("!(x + x + 2) = %d\n", !(x + x + 2)); } int main(){ show_case(-1); // the output is 0 & 1 show_case(0x7fffffff); // the output is 0 & 0; return [...] read more
c++
c
3votes
1answer

Hashing in java hash table

I've been digging in hash table source code. And found how hashing occurs: int index = (hash & 0x7FFFFFFF) % tab.length; I don't understand why bitwise AND used here? if we turn 0x7FFFFFFF into binary we get = 111 1111 1111 1111 1111 1111 1111 1111‬ As I know bitwise [...] read more
java
hash
hashtable
2votes
1answer

Linux hexdump offset strangeness

I'm trying to hexdump some bytes near the end of a 1 TB hard disk drive. First, let's look near the beginning, 0x1000: % hexdump -n 16 -s 0x1000 -C /dev/sda2 00001000 08 70 b5 7c 20 4c 56 4d 32 20 78 5b 35 41 25 72 |.p.| LVM2 [...] read more
linux
2votes
4answers

Ubuntu 11.04 Server Crashing - failed command: READ FPDMA QUEUED

I have a new Ubuntu Server (11.04) that keeps crashing, especially during heavy disk I/O (like making a backup). It's drives are configures as a RAID 10 with 4 1TB Western Digital Caviar Black Hard Drives. The message I'm seeing via /proc/kmsg when it crashes is, "failed command: READ FPDMA [...] read more
ubuntu
server-crashes
ubuntu-11.04
2votes
0answers

Java.lang.ArithmeticException: / by zero in LinearProbingHashSet

I get ArithmeticException: / by zero when I run my code, how I can correct it. Why I get this error despite of I have 5 array size, when I run debugging I get the error at hash(Key key). How I can correct the error message please. any one can [...] read more
java
exception
hash
insert
2votes
1answer

How to decode using lame (mp3->wav) in c++

Thank you so much for answering this question. I use lame and I want to decode mp3 file to wav. I succeeded in decoding mp3 files into wav files through several searches. However, the size of the wav file is created too large and an error message appears. Media player [...] read more
c++
decode
lame
2votes
0answers

Suppress specific sanitizer check, but still fail program on all others

I would like to suppress one error in a third-party library, but still have the program exit 1 on any other failed check. It seems to me that -fno-sanitize-recover will exit the program regardless of the suppressions file's contents. With -fsanitize-recover on the other hand, the specified error is correctly [...] read more
c++
clang
sanitizer
ubsan
2votes
2answers

Windows Virtual Address Space

as I read here the virtual address space of a 32 bit Windows application has 2GB of storage (from 0x00000000-0x7FFFFFFF). The other 2GB are reserved for the system address space. However, I found a pointer in a 32bit program (using Cheat Engine) which is pointing to an address which isn't [...] read more
windows
pointers
system
cheat-engine
2votes
2answers

Why MIN_VALUE and MAX_VALUE in Integer class is defined @native?

I was going through Integer class code and noticed MIN_VALUE and MAX_VALUE are annotated with @native. My question is 1. What is the purpose of using @native annotation? 2. Where can we find native code which is used by @native? 3. Is there any use case where we should use [...] read more
java
2votes
3answers

printf Implemented by Apple

https://opensource.apple.com/source/xnu/xnu-201/osfmk/kern/printf.c.auto.html Hello! While analyzing Apple's printf code, I have a question! case 's': { register char *p; register char *p2; if (prec == -1) prec = 0x7fffffff; /* MAXINT */ p = va_arg(*argp, char *); if (p == (char *)0) p = ""; if (length > 0 && !ladjust) { [...] read more
c
2votes
1answer

How can I correctly check that integer underflow and overflow will not happen before subtraction?

I'm currently working on a safe integer library for C++. I've come across some issues when implementing subtraction. Here's what I start with: #include <limits> #include <stdexcept> template<typename I> class safe_int { I val; public: typedef I value_type; static constexpr I max = std::numeric_limits<I>::max(); static constexpr I min = std::numeric_limits<I>::min(); [...] read more
c++
integer
subtraction
integer-overflow
2votes
2answers

Why is 0x1 interpreted as less than 0xC0000000?

I'm learning about binary representation of integers and tried to write a function that returns an int multiplied by 2 using saturation. The thought process is if the value overflows positively the function returns INT_MAX, and conversely if it overflows negatively it returns INT_MIN. In all other cases the binary [...] read more
c
binary
integer
hex
bit-manipulation
2votes
1answer

What do the parameters of stb_png_to_mem mean?

I am using the stb libraries to load textures on the fly for OpenGL. I'm trying to use the function from stb_image_write.h. I cannot find any documentation on how to properly use the function stbi_write_png_to_mem my code looks like the following #ifndef STB_IMAGE_WRITE_IMPLEMENTATION #define STB_IMAGE_WRITE_IMPLEMENTATION #include <stb/stb_image_write.h> int main( ) [...] read more
c++
opengl
png
textures
stb-image
2votes
1answer

INT_FAST16_MAX does not reflect type size in MSVC 2010?

C99 defines int_fast16_t as an "integer types being usually fastest having at least the specified width", and Microsoft define it as a 32-bit integer in MSVC 2010: typedef char int_fast8_t; typedef int int_fast16_t; typedef int int_fast32_t; typedef unsigned char uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; Yet, Microsoft [...] read more
c
visual-studio-2010
c99
stdint
1vote
0answers

Is my SSD failing?

I've started getting these messages intermittently (see below). I got a whole lot of them several days ago, then they stopped. They occurred again last night, and stopped after the last line below. My /dev/sda is a Samsung 850 EVO Series 120GB SSD and is under warranty. It still seems [...] read more
linux
hard-drive
1vote
1answer

Linux root filesystem on custom hardware

I have a custom-designed SoC implemented on FPGA, based on an ARM-processor clone, on which I am trying to boot Linux (kernel 3.10). I have successfully added support to my custom peripherals (an USART, Interrupt Controller and Timer), allowing me to see the printk messages displayed by the kernel up [...] read more
boot
memory
filesystems
linux-kernel
1vote
1answer

Can't connect to AWS instance after import with stock Centos7

I am trying to import a Centos7 based VM into Amazon AWS. The VM was created with the Centos7 minimal ISO installed into VirtualBox. Networking in the VM works fine locally before trying to do the import. I am using the EC2 command line tools to do the import: ec2-import-instance [...] read more
amazon-ec2
amazon-web-services
centos7
import
1vote
0answers

CentOS Raid 1 drive fails on raid-check

I have a pair of HP DL320e servers configured identically with two WD Red 6TB drives in a software raid 1 array. The DL320e has an on board raid controller which is disabled in favour of linux software raid. Both machines seem to work fine and the raid arrays look [...] read more
raid1
centos7
1vote
3answers

Using bit shifting with rand() to allow for a larger random range

I am reviewing a function to generate keys for a Radix Map and found the implementation of rand() to be novel to me. Here is the function: static int make_random(RadixMap *map) { size_t i = 0; for (i = 0; i < map->max - 1; i++){ uint32_t key = (uint32_t) [...] read more
c
1vote
1answer

error running gem5 full system on ARM bigLITTLE

I installed gem5 on my ubuntu 18.04.5. If I run a generic fs.py ARM architecture then the simulation boots up fine no matter what configuration I use. For example: ./build/ARM/gem5.opt configs/example/fs.py --kernel=/home/ting-bazinga/gem5/fs_imgs/binaries/vmlinux.arm64 --disk-image=/home/ting-bazinga/gem5/fs_imgs/disks/aarch32-ubuntu-natty-headless.img I followed multiple tutorials to run gem5 in full system mode in ARM bigLITTLE architecture but none [...] read more
linux
linux-kernel
gem5
1vote
2answers

localtime() crashes when pass value >0x7FFFFFFF

According to my understanding time_t rawtime = 0xffFFffFF is GMT: Sunday, February 7, 2106 6:28:15 AM But programm below brings Thu 1970-01-01 02:59:59 MSK in some compilers and just crashes in others. int main() { time_t rawtime = 0xffFFffFF; struct tm ts; char buf[80]; ts = *localtime(&rawtime); strftime(buf, sizeof(buf), "%a [...] read more
c
time-t
1vote
2answers

Why do strtod() and strtof() of the Newlib C Standard Library implementation uses dynamic memory allocation?

Newlib is a C standard library implementation (largely inspired by BSD libc) intended for use on embedded systems. Apparently, the string to floating point conversion functions (strtod, strtof) use dynamic memory allocation by calling a function called Balloc, which calls _calloc_r which calls _malloc_r. Why? I tried to look at [...] read more
c
embedded
newlib
c-standard-library
strtod
1vote
1answer

Linux: inter process communication by tcp 127.0.0.1 on the same node very slow

Tcp communication is very slow by 127.0.0.1 or eth IP(eg:10.10.253.12) on the same host. server listen on 0.0.0.0:2000, client connect to 127.0.0.1:2000 or local eth ip:10.10.253.12:2000, CS transfer speed only 100KB per second. Program written by C using libevent and Java using Netty have the same effect, program written as: [...] read more
networking
server
tcp
client
loopback
1vote
0answers

How do I print literal bytes in python?

I have this little script to encode and decode a header HEADER_LENGTH = 4 class Header: def encode(length: int, isRequest: bool): if length > 0x7fffffff: raise ValueError("length too big to handle") byteList = [(isRequest << 7) + ((length >> 24) & 0x7f), (length >> 16) & 0xff ,(length >> 8) [...] read more
python-3.x
string
hex
byte
1vote
1answer

How can I load the absolute address of a symbol larger than 0x7FFFFFFF in RiscV64 assembly

I am writing a kernel and I need to self relocate above 0x7FFFFFFF. To do that, I need to refer, using absolute addressing, to the beginning and end of my kernel and to a symbol, where execution continues after the relocation. I have been unable to figure out any way [...] read more
assembly
riscv
relocation
1vote
7answers

How to find TMax without using shifts

Using ONLY ! ~ & ^ | + How can I find out if a 32 bit number is TMax? TMax is the maximum, two's complement number. My thoughts so far have been: int isTMax(int x) { int y = 0; x = ~x; y = x + x; return [...] read more
c++
c
binary
logic
bit-manipulation
1vote
1answer

NULLs in q and in k.h

I've found different values for h NULLs between k.h and q: q)0x00 vs 0W 0x7fffffffffffffff q)0x00 vs 0N 0x8000000000000000 q)0x00 vs 0Ni 0x80000000 q)0x00 vs 0Wi 0x7fffffff q)0x00 vs 0Wh 0x7fff q)0x00 vs 0Nh 0x8000 In q it all looks familiar, but in k.h nh seems quite strange: // nulls(n?) [...] read more
kdb
k
1vote
2answers

In C++, how do I pass a 32 bit number into an 'int' variable without anything above 0x7FFFFFFF being considered negative?

I need to have an int variable go up to 4294967295 (0xFFFFFFFF), without using unsigned and long, so it can actually be used by other functions. Is that even possible? read more
c++
1vote
1answer

needs to understand the meaning behind 0x7fffffff and 0xffffffff80000000 in terms of memory address space layout

# 0x00007f33caf5a85f: cmp rax, 0xffffffff80000000 # 0x00007f33caf5a865: jnl 0x7f33caf5a898 ... target_of_jnl: # 0x00007f33caf5a898: cmp rax, 0x7fffffff # 0x00007f33caf5a89e: jle 0x7f33caf5a8c8 The above code snip is part of an execution flow of function _M_extract_int() in libstdc++. I don't understand the meaning of the two compares. I think 0xffffffff80000000 is the top [...] read more
assembly
x86-64
sign-extension
1vote
3answers

Reconstructing an integer using bitwise operators

I'm working on an assignment in which I have to generate a random number of variable sizes, store each individual byte inside of an array, and then reconstruct that number by concatenating the bytes. For example, if our number is the 16 bit binary 1100001111110000, we would have one function [...] read more
c
bit-manipulation
bitwise-operators
bit-shift
bitwise-or
1vote
1answer

Cannot compile Modelica program as max memory allocation for array has been reached (Compiler is out of heap space)

I'm currently attempting to compile a Modelica program in Dymola. I have been running into issues which says the compiler is out of heap space (fatal error C1060), the total size of array must not exceed 0x7fffffff bytes (error C2148) and warning C4307: '*': signed integral constant overflow. I've tried [...] read more
c++
compiler-errors
modelica
dymola
1vote
2answers

How to detect X32 ABI or environment in the preprocessor?

X32 is an ABI for amd64/x86_64 CPUs using 32-bit pointers. The idea is to combine the larger register set of x86_64 with the smaller memory and cache footprint resulting from 32-bit pointers. It provides up to about a 40% speedup. See Difference between x86, x32, and x64 architectures on Stack [...] read more
c
gcc
clang
c-preprocessor
linux-x32-abi
1vote
1answer

Spring Boot application using the Spring Cloud Stream Kafka Binder + Kafka Streams Binder not working - Producer doesn't send messages

My Spring Boot 2.3.1 app with SCS Hoshram.SR6 was using the Kafka Streams Binder. I needed to add a Kafka Producer that would be used in another part of the application so I added the kafka binder. The problem is the producer is not working, throwing an exception: 19:49:40.082 [scheduling-1] [...] read more
spring-boot
apache-kafka-streams
spring-cloud-stream
spring-cloud-stream-binder-kafka
1vote
1answer

Win32 compiler option and memory allocation

I tried to compile the following code: extern "C" { #include "netcdf.h" } int main() { const int Ntime = 336; const int Nlon = 1442; const int Nlat = 1021; double* dhsum_vals = new double[Ntime * Nlat * Nlon]; } When compiling with the 32-bit version, I get the [...] read more
c++
compatibility
1vote
0answers

Procedurally Generated Voronoi Roads

i'm using a noise function inspired by libnoiseforjava to try and generate roads. (See below) public class VoronoiNoise { private static final double SQRT_2 = 1.4142135623730950488; private static final double SQRT_3 = 1.7320508075688772935; private long seed; private short distanceMethod; private final double frequency; public VoronoiNoise(long seed, double frequency, short distanceMethod) [...] read more
java
random
noise
voronoi
procedural-generation
1vote
2answers

Spring Cloud Stream Kotlin Consumer Problem

I'm trying to use Spring Cloud Stream from Kotlin. I wrote a simple consumer as follows: @Bean fun log(): Consumer<Person> { return Consumer<Person> { person: Person -> println("Received: ${person.name}") } } Spring Cloud Stream does not find this consumer and quits immediately. It doesn't give an error, but just terminates. [...] read more
kotlin
spring-cloud-stream
consumer
1vote
1answer

What's the most efficient way of getting position of least significant bit of a number in javascript?

I got some numbers and I need to get how much they should be shifted for their lower bit to be at position 0. ex: 0x40000000 => 30 because 0x40000000 >> 30 = 1 768 = 512+256 => 8 This works if (Math.log2(x) == 31) return 31; if (Math.log2(x) > [...] read more
javascript
bit-manipulation
bit
1vote
1answer

Perlin noise glitch

I have an infinite map generator. It works well with positive coordinates. Positive coordinates generation 1 But on negative coordinates I have this trash: Negative coordinates broken generation 2 void generateChunk(int x0, int y0) { Chunk chunk = new Chunk(x0, y0); for(int yTile = 0; yTile < Chunk.CHUNK_SIZE; yTile++) { [...] read more
java
game-engine
game-development
procedural-generation
1vote
0answers

React and rSocket REQUEST_CHANNEL error with Spring Boot

We have a working demo between React and Spring Boot Data Geode using rSocket for fire & forget, request response and request stream but when we try and use request channel we get error: org.springframework.messaging.MessageDeliveryException: Destination 'quotes' does not support REQUEST_CHANNEL. Supported interaction(s): [REQUEST_STREAM] So far on web it looks [...] read more
spring
spring-boot
spring-data-gemfire
rsocket
1vote
1answer

Does this code violate One Definition Rule?

Some code in AOSP10 seems to violate ODR: source 1: struct ExtentsParam { void init (const OT::cff1::accelerator_t *_cff) { path_open = false; cff = _cff; bounds.init (); } void start_path () { path_open = true; } void end_path () { path_open = false; } bool is_path_open () const { return [...] read more
c++
one-definition-rule
0votes
0answers

Reading SMART results for failing disk

I recently started having trouble with my Dell laptop and would appreciate any recommendations on the next steps for my issue. I have portions of the dmesg log below to show the errors I'm getting. My laptop has 6 GB RAM and 1 TB convential hard drive (no SSD) running [...] read more
linux
hard-drive
rsync
smart
0votes
0answers

Input/Output error while playing video

I am using Linux Mint 15. Nowadays I am getting Input/Output error while watching movies. Sometimes when I copy/paste, I get the same error. What should I do? I have a laptop so unable to check inside the machine. If the hard disk is corrupt, how to take the backup [...] read more
linux
hard-drive
video
linux-mint
hardware-failure
0votes
1answer

need help SolusVM Xen-pv error

I recently use Solusvm and xen and I have a problem with xen-pv there is a xen-pv template by default with the solusvm Centos-5.3-x86 I have created a machine to test it but I have this error : xm create -c vm103.cfg Using config file "./vm103.cfg". Started domain vm103 (id=45) [...] read more
linux
xen
0votes
1answer

SCSI error: return code = 0x08000002, sense key: Aborted Command

The kernel logs: ata2.00: exception Emask 0x0 SAct 0x7fffffff SErr 0x0 action 0x0 ata2.00: irq_stat 0x40000008 ata2.00: cmd 61/08:f0:6f:5b:97/00:00:00:00:00/40 tag 30 ncq 4096 out res 41/10:01:6f:5b:97/d5:00:00:00:00/40 Emask 0x481 (invalid argument) <F> ata2.00: status: { DRDY ERR } ata2.00: error: { IDNF } ata2.00: configured for UDMA/133 sd 1:0:0:0: SCSI error: [...] read more
software-raid
raid1
scsi
smart
dmraid
0votes
0answers

how to convert GCCRandom(Mersenne Twister by Takuji Nishimura and Makoto Matsumoto) from Game Coding Complete by Mike McShaffry 4E to stl random

I am trying to translate the book Game Coding Complete by Mike McShaffry 4E to modern C++17 standard and faced with the code of Mersenne Twister by Takuji Nishimura and Makoto Matsumoto. Is it right to convert random generator code from book like that: from: #include <ctime> #define CMATH_N 624 [...] read more
c++
random
stl
game-engine
mersenne-twister
0votes
0answers

guru meditation error: core 0 panic'ed (loadprohibited) while working with custom library

I am working on a median filter on the ESP32 board. This median filter is based on a circular buffer. I implemented the filter into the main.c and it worked just fine. However as I created a custom library and called the function from the main.c the ESP32 just reboots [...] read more
c
esp32
freertos
platformio
0votes
0answers

How to change kernel base address

I am trying to boot linux on a zedboard and monitor all memory accesses through Programmable Logic. We're first trying to boot linux with a start address above 0x40000000. I want all the memory request has to passed through the PL and PL will access the DDR for read/store. I [...] read more
linux-kernel
memory-address
xilinx
petalinux
0votes
0answers

How to search value in memory

i am developing desktop app (memory scanner). the core of the app is kernel driver and dll who communicate with each other. in my kernel driver i use all the low level function of Nt and Zw undocumented Functions i success to get from random process: * all the modules [...] read more
c++
kernel
driver
virtual-memory
stack-memory
0votes
1answer

Memory leak while using OpenCV C++ from Unity

i'm make my first OpenCV Plugin using C++. But, it has some issue. 1. Image glitch 2. Memory leak 화면-기록-2021-03-07-오전-12 23 13 [https://user-images.githubusercontent.com/16532326/110211847-cd2abd80-7edb-11eb-9000-b29fa03275e6.gif] This is what it running looks like. EXPECTED BEHAVIOR Get the document of drawing picture and export only draw lines. SOURCE All source Xcode OSX 12.4 or [...] read more
c#
android
c++
opencv
unity3d
0votes
2answers

How to get OTP token for an existing user in django using django-two-factor-auth

I am writing selenium tests for django. I want to login a user with OTP through UI using selenium. After login , I get the setup page where I am supposed to enter a 6 digit token generated by google authenticator. django-two-factor-auth stores a secret key per user in table [...] read more
python
django
google-authenticator
django-two-factor-auth
0votes
1answer

Trying to use perlinnoise for generation of terrain

I am trying to generate a procedural terrain using perlin noise. Before, I was just creating a 1000 * 1000 vertice terrain so I just had a simple function that would fill the height map with the noise values. However now I am trying to generate a terrain that generates [...] read more
c++
noise
procedural-generation
0votes
1answer

Question about conv2D in Android NN: the output shape limit

When I was trying the android nn code, found these in Conv2D.cpp: tflite::Dims<4> im2colDim; \ im2colDim.sizes[3] = (int)getSizeOfDimension(outputShape, 0); \ im2colDim.sizes[2] = (int)getSizeOfDimension(outputShape, 1); \ im2colDim.sizes[1] = (int)getSizeOfDimension(outputShape, 2); \ im2colDim.sizes[0] = (int)inDepth * filterHeight * filterWidth; \ \ im2colDim.strides[0] = 1; \ for (int i = 1; i < [...] read more
android
deep-learning
neural-network
tensorflow-lite
nnapi
0votes
1answer

Using fdlibm library in C

I am trying to use the fdlibm library in C to compute sin of a large number. I used the code from this link: http://www.netlib.org/fdlibm/ and downloaded the folder "s_sin.c plus dependencies". When I run the c code in that folder "s_sin.c", I get the following error: > Undefined symbols [...] read more
c
0votes
1answer

how can I simulate cpu and memory stress powershell

I'm doing a cpu and memory stress test on windows server 2016 and 2019 When I run it on the virtual server the results are successful 100% load Not enough load occurs when I run it on physical server How can i solve this situation **cpu_stress** <# .EXAMPLE .\cpu_stress.ps1 This [...] read more
powershell
0votes
0answers

TreeWidget Rapid Updates Causing Crash

I am at a dead end after spending the last year of my life building a PySide2 application that rapidly displays data using a TreeWidget. After starting the application, the data is appended without issue. However, after a few minutes, the program becomes very unstable/slow and eventually becomes unresponsive. Sometimes [...] read more
python
pyside2
qtreewidget
qtreewidgetitem
0votes
0answers

CELT's numerical approximation of 2^x

I cam cross a fast good approximation routine from celt as (https://chromium.googlesource.com/chromium/deps/opus/+/1.0.x/celt/mathops.h), you can see code as below: /** Base-2 exponential approximation (2^x). */ static inline float celt_exp2(float x) { int integer; float frac; union { float f; opus_uint32 i; } res; integer = floor(x); if (integer < -50) return [...] read more
approximation
polynomial-approximations
0votes
1answer

Determing the highest possible color and depth attachement sampled count in Vulkan

Do I need to set the value of VkAttachmentDescription::samples to a power of 2 or are arbitrary values allowed, as long as they don't exceed the maximum supported by the hardware? I'm really confused about this. The samples field is of type VkSampleCountFlagBits, which is declared in the following way [...] read more
graphics
vulkan
0votes
1answer

Canon EDSDK 13.11.10 not saving to host PC

I'm in the process of implementing a remote camera control app with Canons EDSDK. My camera is a Canon PowerShot SX 70 HS. So far everything seems to work, except for the functionality to save the taken picture to the host-PC. My understanding of the needed workflow is the following: [...] read more
c++
camera
remote-control
edsdk
canon-sdk
0votes
1answer

How do I assign -0x80000000 to long long variable in VS2019?

I am using Visual Studio 2019 Community edition. I have the following C++ code snippet: long long l = 0x80000000; assert(l > 0); //true l = -0x7fffffff; assert(l < 0); // true l = -0x80000000; assert(l < 0); // FALSE I expect -0x80000000 to end up sign-extended to 64-bit value [...] read more
visual-studio
c++17
64-bit
signed
negative-integer
0votes
0answers

Bad Hash Function

I am confused about the hash function. This is a good hash function private int hash(K key) { return (key.hashCode() & 0x7fffffff) % M; } How would I turn that into a very bad hash function, would it be like this? private int hash(K key) { return (key.hashCode() & 17) [...] read more
java
0votes
0answers

Clang++ LSAN and UBSAN causes undefined reference to `__ubsan_handle_add_overflow'

When I was playing with compiler sanitizers, I was confused by this linking error when only LSAN and UBSAN are enabled on clang++. Note that the linking problem disappeared when I removed -fsanitize=leak or added these flags together: -fsanitize=leak -fsanitize-trap=undefined. Also note that this strange linking error seemed to only [...] read more
clang
clang++
sanitizer
ubsan
leak-sanitizer
0votes
1answer

How to watch what's happening to the global array's while debugging inside function in c++?

I just wanted to see how subTree array is changing while i am iterating over dfs() function. enter image description here [https://i.stack.imgur.com/LtIk0.png] Here is the code: #include<bits/stdc++.h> using namespace std; #define w(x) int x; cin>>x; while(x--) #define nl "\n" #define fr(i,t) for(int i=0;i<t;i++) #define fr1(i,a,b) for(int i = a; i<b; [...] read more
c++
debugging
visual-studio-code
0votes
0answers

converting Golang float32 to half-precision float (GLSL float16) as uint16

I need to pass some data over from Go to an '300 es' shader. The data consists of two uint16s packed into a uint32. Each uint16 represents a half-precision float (float16). I found some PD Java code that looks like it will do the job, but I am struggling with [...] read more
go
half-precision-float
0votes
1answer

BSONRmgExp is not defined

I am working through a Node.js tutorial and we just started working with Mongoose. Everything has been going great until today. I turned on my computer and opened WebStorm. I went to run what we had last worked on and I get the following stack trace: /usr/bin/node /home/doug/Documents/node-course/task-manager/src/db/mongoose.js /home/doug/Documents/node-course/task-manager/node_modules/bson/index.js:41 BSON.BSONRegExp [...] read more
javascript
node.js
mongodb
mongoose
0votes
0answers

Windows 7 Group Policy - Powershell Script Creates a Rule, Doesn't appear in GP Editor

I am running a Powershell command to add a rule to my Local Group Policy Editor for Windows Firewall with Advanced Security - Local Group Policy Object. For example, this is from ConfigureRemotingForAnsible.ps1 script. Function Enable-GlobalHttpFirewallAccess { Write-Verbose "Forcing global HTTP firewall access" # this is a fairly naive implementation; [...] read more
powershell
group-policy
0votes
0answers

Why does gcc make "!(T_MAX+T_MAX+2)" equal to 0?

For gcc 9.3.0, when I try to print it as int x = 0x7fffffff; printf("%d", !(x+x+1+1)); it gives me 0. But when I try to print it as int temp = (x+x+1+1); temp = !temp; printf("%d", temp); it gives me 1 as expected. What happens? read more
c
gcc
0votes
0answers

On the special case of float2int

When I try to complete float2int with the following function int float2int(unsigned uf) { int s_ = uf>>31; int exp_ = ((uf&0x7f800000)>>23)-127; int frac_ = (uf&0x007fffff)|0x00800000; if(!(uf&0x7fffffff)) return 0; if(exp_ > 31) return 0x80000000; if(exp_ < 0) return 0; if(exp_ > 23) frac_ <<= (exp_-23); else frac_ >>= (23-exp_); if(!((frac_>>31)^s_)) [...] read more
floating-point
integer
0votes
1answer

Minikube apiserver stopped frequently

I am using minikube v1.11.0 on Microsoft Windows 10 Pro . my minikube stopped frequently ,Find minikube status Minikube Status: type: Control Plane host: Running kubelet: Running apiserver: Stopped kubeconfig: Configured minikube logs: Failed to list *v1.Service: Get https://10.96.0.1:443/api/v1/services?limit=500&resourceVersion=0: dial tcp 10.96.0.1:443: connect: connection refused Failed to list *v1.Namespace: Get [...] read more
kubernetes
minikube
0votes
0answers

Compiler says parameter list is wrong, then in next sentence says function is an unresolved external symbol? How is this possible? How to fix?

I'm confused by this. The compiler is complaining about an unresolved external symbol... but if I add a parameter to it, it still knows to complain about the added parameter. enter image description here [https://i.stack.imgur.com/cxZw0.jpg] The function definition with the types and macros, in util.h (which is already included by [...] read more
c
function
compiler-errors
header
include
0votes
0answers

SIMD min slower than normal scalar

I'm trying to find the minimum of an array which has exactly 4 elements. Each element is a signed int type, but only non-negative numbers are used, and -1 is used to represent an invalid value. The instructions generated for the 2nd version is using SSE which uses SIMD shuffle [...] read more
c++
assembly
sse
simd
avx
0votes
0answers

(FUZZING) Get a pointer to data range of dynamic array

EDIT: Clarification: If I have an array int* a = new int[10], I want to get a pointer to a, but only the values from 0 to 5, without having to allocate another array for those values. Original post: I created a small class to fuzz my functions, but the [...] read more
c++
memory
memory-management
fuzzing
0votes
0answers

iOS: Does app by default has any restrictions when doing network requests when app was killed (swiped away)?

First of all I would like to notice that I am not experienced iOS developer, I am writing app in React Native. The essence of the problem: If my app was swiped away and push notification from FCM arrived, I would like to send network request in response to user [...] read more
ios
objective-c
react-native
0votes
2answers

Canon EDSDK handler isn't called on mac

I'm programming tethering for the canon camera in Qt under Mac OSX and for some reason my handlers for sdk are not called. When I want to shoot with camera it's all goes well but my photo is not downloaded because EdsSetObjectEventHandler is not called. BUT for some reason when [...] read more
c++
macos
qt
edsdk
0votes
1answer

Reading from Protected Process Memory

I'm trying to read the memory of a process. The actual code loops through the process' memory and searches for values but this is the general idea. I'm compiling for x64 and attempting to read x64 processes. This code fails after the call to VirtualProtectEx with either error code 5 [...] read more
c#
winapi
0votes
1answer

What is the type of the size of std::array and if the size is bigger than what's available on the stack, does it throw an exception?

I'm using MSVC++. If I define an std::array with a size bigger than 2^31 - 1 I get this error: > C2148 total size of array must not exceed 0x7fffffff bytes That makes me deduce that the type for the size is a signed 32 bit integer. But why using [...] read more
c++
arrays
size
stdarray
0votes
2answers

Rounding 64 bit integers to 32 bit integers

I have a function that does rounding operation as shown below. It takes 64bit integer as input and gives 32bit integer as output. While converting, a factor of 0x40000000 is being added to the input. What is the reason behind it? int rounder(long long int in) { INT64 out; if [...] read more
c
rounding
int64
int32
0votes
1answer

how to print boost multiprecision 128 bit unsigned integer

I want to print integer value that converted from hexadecimal value but i only could print hexadecimal value. #include <iostream> #include <boost/multiprecision/cpp_int.hpp> using namespace boost::multiprecision; cpp_int dsa("0xFFFFFFFFFFFFFFFF"); cpp_int daa("9223372036854775807"); daa = ((daa * 64) + daa); cout << std::hex<<dsa <<std::showbase<< endl; cout <<dsa << endl; cout <<daa << endl; cout [...] read more
c++
boost
boost-multiprecision
0votes
1answer

What's wrong with my implementation of 2 Factor Authorization?

I'm trying to implement my own PHP function to generate codes for Google Authenticator. I do it for fun and to learn something new. Here's what I did: function twoFactorAuthorizationCode(string $secretBase32, int $digitsCount): string { $counter = (int) (time() / 30); $secret = Base32::decode($secretBase32); $hash = hash_hmac('sha1', $counter, $secret, true); [...] read more
php
authorization
sha1
one-time-password
google-authenticator
0votes
1answer

Printing out DWORD in hex returns 0x7FFFFFFF in win32 c++

I'm currently working on win32 application that uses sha1 hash on strings to generate keys for my map. I want to use the hash as DWORD, so I can compute some calculations between hashes. Since sha1 hash reproduces 160-bit hash values, I created a struct with 5 DWORD (32-bit * [...] read more
c++
winapi
dword
0votes
3answers

arithmetic right shift shifts in 0s when MSB is 1

As an exercise I have to write the following function: multiply x by 2, saturating to Tmin / Tmax if overflow, using only bit-wise and bit-shift operations. Now this is my code: // xor MSB and 2nd MSB. if diferent, we have an overflow and SHOULD get 0xFFFFFFFF. otherwise we [...] read more
c
bit-manipulation
bit-shift
-1votes
1answer

Aborted (core dumped) removing element from vector in c++

I'm trying to learn C++ using "MUD Game Programming" and I am working through the examples, but when I try to erase a connection from a vector I get an error: "Aborted (core dumped)." This usually happens when erasing the last one from the vector. I have tried solutions such [...] read more
c++
vector
berkeley-sockets
-1votes
1answer

Microsoft C++ implementation of std::mbstate_t

I have some legacy code that works with UTF8/16 conversions and wstream-s. It has been written on VS08-VS10 and it assumes that mbstate_t's type is int. It uses it to check on some states like while(_State & 0x80000000 && ...) and unsigned n = _State & 0x7FFFFFFF; if(n<=0x3F)... But now [...] read more
c++
visual-c++
-2votes
2answers

How do I figure out which drive is failing?

How do I relate this information with which physical drive is failing? It's a debian kernel. Nov 21 18:06:00 IHPAC kernel: [594026.608042] ata5.00: status: { DRDY } Nov 21 18:06:00 IHPAC kernel: [594026.787427] ata5.00: failed command: WRITE FPDMA QUEUED Nov 21 18:06:00 IHPAC kernel: [594026.966505] ata5.00: cmd 61/00:e8:fb:b6:59/04:00:a2:00:00/40 tag 29 [...] read more
hard-drive
-2votes
1answer

Why are the results different when I did bitwise right shift in C language?

I wrote the following code to understand the bit-wise right shift operation, unsigned long a = 0; unsigned long b = 0xFFFFFFFF; a = ~a; // now a is equal to b a = a >> 1; b = b >> 1; printf("a = %x\n", a); // result: a = [...] read more
c
bit-shift
-3votes
1answer

Linker error: Multiple definition of a function

I'm trying to write a program that includes .cpp and .h files. Here is my code: main.cpp: #include "beep.h" #include "movecursor.h" beep.h: #include <Windows.h> #include <mmsystem.h> DWORD WINAPI BeepSec(LPVOID parameters); beep.cpp: #include "beep.h" #include "random.h" DWORD WINAPI BeepSec(LPVOID parameters) { } movecursor.h: #include <Windows.h> #include "beep.h" DWORD WINAPI MoveCursor(LPVOID parameters); [...] read more
c++
winapi
linker

Comments

Leave a comment

(plain text only)

Sources

  1. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0