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

122votes
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
122votes
9answers

How does Python manage int and long?

Does anybody know how Python manage internally int and long types? * Does it choose the right type dynamically? * What is the limit for an int? * I am using Python 2.6, Is is different with previous versions? How should I understand the code below? >>> print type(65535) <type [...] read more
python
integer
85votes
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
65votes
2answers

Performance difference between Windows and Linux using Intel compiler: looking at the assembly

I am running a program on both Windows and Linux (x86-64). It has been compiled with the same compiler (Intel Parallel Studio XE 2017) with the same options, and the Windows version is 3 times faster than the Linux one. The culprit is a call to std::erf which is resolved [...] read more
c++
assembly
x86-64
icc
vtune
14votes
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
12votes
1answer

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
1answer

Clang 8 with MinGW-w64: How do I use address- & UB sanitizers?

Clang 8 release notes have this promising line: > * Allow using Address Sanitizer and Undefined Behaviour Sanitizer on MinGW. However, I unable to figure out how to use those properly. I'm using Clang 8.0.0 with MSYS2 MinGW GCC. Exact details are at the bottom of the question. I'm trying [...] read more
c++
clang
mingw-w64
address-sanitizer
ubsan
9votes
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
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
6votes
3answers

spring.data.rest.max-page-size does not seem to work?

Under Boot 1.3.0.M5 i use in application.properties spring.data.rest.max-page-size=10 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 There [...] read more
spring-data-rest
5votes
3answers

i dont understand what is 0x7fffffff mean. is there any other way to code getHashValue method?

public int getHashValue(K key){ return (key.hashCode() & 0x7fffffff) % size; } i dont understand what is 0x7fffffff mean. is there any other way to code getHasValue method? read more
java
hash
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
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
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
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

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
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
3votes
0answers

Writing to /dev/mem on a 32-bit system

I'm currently working on a 32-bit architecture Xilinx SoC-FPGA board. A small C-program has to write some data into a specific physical memory region starting at the address 0x80000000. To access the physical memory, /dev/mem is used. The program opens the device file and sets the position indicator to the [...] read more
c
linux
file
memory-management
file-handling
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
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
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
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
2votes
2answers

What is the error in code? This seems to run fine in my IDE but doesn't work on online terminal

I'm trying to solve the leetcode question 8String to integer(atoi). But I'm getting a Runtime Error. TypeError: 'str' object is not callable Line 9 in myAtoi (Solution.py) I understand it's due to a string object getting called but can't seem to figure out what to fix. class Solution: def myAtoi(self, [...] read more
python
python-3.x
string
typeerror
2votes
2answers

Separate object fields into two files by serializing DataContract

I an using DataContractSerializer and i want to separate data of same object into multiple files. [DataContract] public class TestObj { [DataMember] protected double field1 = 0.0; [DataMember] protected double field2 = 0.0; } Specifically I want to save field1 in one XML file and field2 in a different XML [...] read more
c#
serialization
datacontractserializer
datacontract
2votes
1answer

I'm using std::bitset and trying to create two arrays std::bitset with size 100,000,000,000

I am using std::bitset and I try to create two arrays std::bitset with size 100,000,000,000. As a result, program fills only 298 MB of my RAM but must to fill ~24 GB. I have 32 GB RAM and now 26 GB are free. When I build my code for x86, [...] read more
c++
windows
std-bitset
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
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
0answers

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
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
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 generation2 void generateChunk(int x0, int y0) { Chunk chunk = new Chunk(x0, y0); for(int yTile = 0; yTile < Chunk.CHUNK_SIZE; yTile++) { for(int xTile [...] 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
1vote
0answers

Counting 1's and 0's in a bit sequence

These two methods are from Hacker's Delight. I wish to count the number of 0's and 1's in a bit sequence. For example, for the following sequence 00000000000000000011011100111101 , I thought after removing the leading zeros I would get: * 2 Ones * 1 Zero * 3 Ones * 2 [...] read more
java
bit
1vote
0answers

What is source of IID 0x7ffffff error in CCES debugger, and how to fix it properly?

I have problems with MDMA transfer on ADSP-SC584. I work in CCES IDE 2.8.3 I take MDMA CrossCore example project ,and do changes towards ARM direction of data flow. So initialisation is the same(MCAPI addresses and SID of interrupt). I have complex problem with it: 1. When i run project [...] read more
c
udp
micrium
1vote
1answer

Bitshift Causing Overflow When It Shouldn't

When I am bitshifting the max positive 2's complement, shouldn't shifting it 31 bits make an effective 0 because it starts as 0111 1111, etc. I have tried decreasing the shift but I am assuming it's just the computer reading it incorrectly. int main(void) { int x = 0x7FFFFFFF; int [...] read more
c
linux
bit-shift
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

Verilog modules and testbench

How to write the verilog modules for each of the following digital circuit components and then create a testbench? Multiplexer Implement a 8x1 32-bit multiplexer. Input: x (8 32-bit numbers), and sel (3 bits). Output: y (32 bits). x is the data input (x[0], ..., x[7]). The multiplexer should use [...] read more
verilog
computer-science
cpu-architecture
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
0answers

InputStream utility based on the java.nio package. Reads up to 32 bits at a time from a file, using multiple buffers to quickly process read calls

I have an assignment where you should use Huffman coding to compress/un-compress binary files, and the professor sent us this input stream class to help us, I don't understand how it works. so, I was hoping if anyone knows a good website or any sources that can help me understand [...] read more
java
compression
bufferedreader
huffman-code
bitstream
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

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

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

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

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

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
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
0answers

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
tf-lite
nnapi
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
0answers

Cannot Iterate trough the element of a Hash?

So im following some lessons on hashes and i'm mostly done, i'm just trying to test the class but i cant manage to print all the values because of something that must have to do with the Iterator (?) Hash class: package com.ghevi.ads.hashes; import com.ghevi.ads.linkedlists.LinkedList; import java.util.Iterator; public class Hash<K, [...] read more
java
data-structures
hash
iterator
hashcode
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
0answers

Docker commands gives fatal error: traceback did not unwind completely

I installed the Docker engine successfully and pulled an image as a test (tomcat) and run it and it works OK, but when I restarted the system, any docker command when I run, I get this error: runtime: g6: frame.sp=0xc000081ef8 top=0xc000081fb8 stack=[0xc000081000-0xc000082000] n=0 max=2147483647 fatal error: traceback did not unwind [...] read more
docker
ubuntu-18.04
ubuntu-server
0votes
0answers

Node.js: axios and basic authorization issues with TOTP post request

I'm trying to complete a challenge that requires to create a TOTP password and send a post request with it using basic auth. If the request succeeds, I will receive an email with further instructions. I'm coding everything in Node.js. I created a TOTP algorithm that I tested with the [...] read more
javascript
node.js
cryptography
axios
authorization
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
0answers

python pandas iloc bug or a feature?

This is my function to merge 2 dataframes by matching field values. #allow you to merge (left join) 2 dataframes def levenstein_merge(dfa, dfb, left_on, right_on, limit = 0x7FFFFFFF): #0x7FFFFFFF is a max integer import pandas as pd import Levenshtein as l a = dfa[left_on] b = dfb[right_on] mindst = 0x7FFFFFFF [...] read more
python-3.x
pandas
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
0answers

How to get the seed according to the MT19937 array in python's random module?

I use the random.seed() to set a seed for random module, for example: >>> import random >>> random.seed(123456) Then i use random.getstate() to get the MT19937 array, it should be 624 32-bit integers: >>> MT = random.getstate()[1][:-1] >>> len(MT) 624 But when i check the value of these 624 numbers, [...] read more
python-3.x
random
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
0votes
1answer

Google Authenticator authenticates only the latest "user"

I have been messing with the Google Authentication on PHP for a week right now and I have stumbled upon the issue with multiple "user" authentication. Basically I have downloaded Authentication.php code and using it to generate and verify the codes. <?php class Authenticator { protected $length = 6; public [...] read more
php
0votes
0answers

TOTP python to postgreSQL function

I have simple TOTP python code: import sys, time, math, hashlib, hmac, struct, base64 def totp_gen(secret, time_range=30, i=0): tm = int(time.time() / time_range) b = struct.pack(">q", tm + i) hm = hmac.HMAC(secret, b, hashlib.sha1).digest() offset = ord(hm[-1]) & 0x0F truncatedHash = hm[offset:offset + 4] code = struct.unpack(">L", truncatedHash)[0] code &= [...] read more
python
postgresql
totp
0votes
3answers

Get the greater of two numbers with bitwise operations

I have to find the greater of two numbers using bit manipulation. These are the rules for the same: /* * isGreater - if x > y then return 1, else return 0 * Example: isGreater(4,5) = 0, isGreater(5,4) = 1 * Legal ops: ! ~ & ^ | + [...] read more
c
comparison
max
bit-manipulation
0votes
1answer

How to create digital persona FMD from byte[] in Android?

I am able to save FMD to SQLite in Android. However when I am trying to recreate FMD it is not working properly. Saving FMD in database. try { Fmd m_enrollmant_fmd = m_engine.CreateEnrollmentFmd(Fmd.Format.ANSI_378_2004, enrollThread); if (m_success = (m_enrollmant_fmd != null)) { byte[] fingerprintData = m_enrollmant_fmd.getData(); int fingerprintImageHeight = m_enrollmant_fmd.getHeight(); int [...] read more
android
fingerprint
digital-persona-sdk
0votes
2answers

any docker command gives error: bad symbol table

I installed the docker engine successfully and no error or warning is shown. But after that, whenever I try any docker command, even docker ps, I get this error: runtime: pcdata is -2 and 76 args stack map entries for net/http.(*Transport).dialConn (targetpc=0x55afd17107cb) fatal error: bad symbol table runtime stack: runtime.throw(0x55afd29a0fb2, [...] read more
docker
ubuntu
go
0votes
0answers

Debian does not recognise RAM although BIOS does

My debian system seems not to use the full ram which is installed (6GB) in my mini-itx. Here is some output of dmesg, free and dmidecode that might help. In BIOS, I can see both (2GB + 4GB). root@debian-simon:/home/simon# dmesg | grep -i memory [ 0.016839] initial memory mapped: [mem [...] read more
debian
ram
bios
0votes
0answers

How to keyboard interrupt user32.GetMessageW / user32.SetWinEventHook loop in python?

I can't seem to figure out how to let Ctrl-C interrupt this code. It prints a KeyboardInterrupt exception to the console when you press Ctrl-C but never actually stops the program. How can I make it actually stop? import ctypes import ctypes.wintypes from random import random user32 = ctypes.windll.user32 ole32 [...] read more
python
windows
ctypes
pywin32
0votes
1answer

Should i store data that need to be cast into variable first? or call Dictionary indexer more than once?

I don't really know how to phrase this well but I confused about performance I have variables that read from the dictionary. but sometimes it can contain null. For example, I have the following: Dictionary<string,object> DataRow = new Dictionary<string,object>(); The previous line is reading Row from database Table and fetch [...] read more
c#
.net
dictionary
memory-management
collections
0votes
0answers

How to get rid of automatically added library provided by GCC?

I'm compiling main.c file by gcc with enabled sanitizer option. As a result, linker command contains "-lubsan" option in its arguments list. Need to say, that I haven't provided "-lubsan" option to gcc explicitly. Moreover, I'm against of using it. So, the question is: "How to get rid of such [...] read more
gcc
linker
ubsan
0votes
1answer

structure occurring C2148 when compiling

I have a very large structure, and it seems to be over the limit, what would be the best way to work this out? Error Message: total size of array must not exceed 0x7fffffff bytes structure occurring C2148 when compiling struct listen_instance { struct instance_l instance[2000]; }; I need all [...] read more
c
data-structures
0votes
0answers

Getting memory location of C++ static variable in Visual Studio Community Debugger

In this simple C++ program: int main() { int n = 0xffffff12; static int q = 0x7fffffff; static int r = 0x10000000; static int R = 0x80000000; return 0; } I can retrieve the actual memory location of variable n in Visual Studio Community debugger by looking at the assembly [...] read more
c++
visual-studio
debugging
memory
static
0votes
1answer

Manual vectorization/SSE for a complex problem in C++

I want to speed up my algorithm which is an objective function f(x). The problem dimension is 5000. I have already introduced a lot of improvement in the code, but still the calculation time does not fit to my expectation. Most of the dataset are allocated dynamically as (float*)_mm_malloc(N_h*sizeof(float),16). In [...] read more
c++
gcc
optimization
x86
sse
0votes
1answer

Install GYM openAI win 10/7

I am new here and following this guide ( https://towardsdatascience.com/how-to-install-openai-gym-in-a-windows-environment-338969e24d30 ) it is not possible to install the open AI, there is always an error when compiling. Tried different versions of anaconda ... python version ... adding compiler to path... Any help would be appreciated! Collecting git+https://github.com/Kojoley/atari-py.gitCloning https://github.com/Kojoley/atari-py.git to c:\users...\appdata\local\temp\pip-req-build-ppc4tb1g [...] read more
windows
installation
openai-gym
-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++
-1votes
1answer

Bitwise multiplication with correction for overflow

I am trying to use Bitwise operators ( ! ~ & ^ | + << >> ) in C to achieve a multiplication of 4 while also correcting for Positive and Negative overflow by returning the Max value and Minimum value, respectively. For example, Function(0x10000000) = 0x40000000 Function(0x20000000) = 0x7FFFFFFF [...] read more
c
bit-manipulation
-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

Solving Wormholes (ZCO 2012)

DESCRIPTION: The year is 2102 and today is the day of ZCO. This year there are N contests and the starting and ending times of each contest is known to you. You have to participate in exactly one of these contests. Different contests may overlap. The duration of different contests [...] read more
c++
algorithm
sorting
binary-search
-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