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

98votes
10answers

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
32votes
5answers

Efficient integer floor function in C++

I want to define an efficient integer floor function, i.e. a conversion from float or double that performs truncation towards minus infinity. We can assume that the values are such that no integer overflow occurs. So far I have a few options * casting to int; this requires special handling [...] read more
c++
performance
x86-64
processing-efficiency
floor
21votes
6answers

Why is Int32's maximum value 0x7FFFFFFF?

I saw in MSDN documents that the maximum value of Int32 is 2,147,483,647, hexadecimal 0x7FFFFFFF. I think, if it's Int32 it should store 32-bit integer values that finally should be 4,294,967,295 and hexadecimal 0xFFFFFFFF. My question is why Int32 stores 31-bit integer values? read more
c#
types
int32
14votes
8answers

C macro to create a bit mask -- possible? And have I found a GCC bug?

I am somewhat curious about creating a macro to generate a bit mask for a device register, up to 64bits. Such that BIT_MASK(31) produces 0xffffffff. However, several C examples do not work as thought, as I get 0x7fffffff instead. It is as-if the compiler is assuming I want signed output, [...] read more
c
bit-manipulation
11votes
3answers

point of IT instruction ARM assembly

I've got the following ARM assembly code. CMP R0, #0 ITT EQ MOVEQ R0, #0x7FFFFFFF BXEQ LR Firstly, why is the EQ needed after the MOV and BX instructions? The ARM reference says that the condition (EQ) after the ITT will be applied to the first instruction (MOV) in the [...] read more
assembly
arm
8votes
0answers

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

How to make a smoother Perlin noise generator?

I'm trying to use a Perlin noise generator to make the tiles of a map, but I notice that my noise is too spiky, I mean, it has too many elevations and no flat places, and they don't seem like mountains, islands, lakes or anything; they seem much too random [...] read more
python
random
perlin-noise
7votes
5answers

QSpinBox with Unsigned Int for Hex Input

There are a variety of questions written here about QSpinBox's limitation of using an int as its datatype. Often people want to display larger numbers. In my case, I want to be able to show an unsigned 32bit integer in hexadecimal. This means I'd like my range to be [0x0, [...] read more
c++
qt
hex
unsigned-integer
qspinbox
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
7votes
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
5votes
2answers

why floor, ceil implementation return x + x when x is NaN or inf?

I'm reading IEEE-754 math functions' implementation in glibc. Here is floor implementation. float __floorf(float x) { int32_t i0,j0; uint32_t i; GET_FLOAT_WORD(i0,x); j0 = ((i0>>23)&0xff)-0x7f; if(j0<23) { if(j0<0) { /* return 0*sign(x) if |x|<1 */ if(i0>=0) {i0=0;} else if((i0&0x7fffffff)!=0) { i0=0xbf800000;} } else { i = (0x007fffff)>>j0; if((i0&i)==0) return x; /* [...] read more
c
glibc
ieee-754
floor
5votes
2answers

simulate jg instruction(datalab's isGreater)

I am doing CSAPP's datalab, the isGreater function. Here's the description isGreater - if x > y then return 1, else return 0 Example: isGreater(4,5) = 0, isGreater(5,4) = 1 Legal ops: ! ~ & ^ | + << >> Max ops: 24 Rating: 3 x and y are both [...] read more
c
assembly
instructions
eflags
4votes
4answers

32-bit / 16-bit signed integer division without 32-bit registers?

I'm trying to divide a 32-bit signed integer by a 16-bit signed integer to get a signed 32-bit quotient and 16-bit remainder. I'm targeting a 286 with no fpu. I've already written code in the past to do 32-bit unsigned division: DIV32 PROC ;DIVIDES A 32-BIT VALUE BY A 16-BIT [...] read more
assembly
x86-16
integer-division
4votes
1answer

**polygon.setfillcolor(Color)** not working for google map v2

I am adding a Polygon into Google Map v2 like this: for (int index = coordinats.size()-1; index >= 0; index--) { polygonOptions.add( new LatLng(latCoordinats.get(index), lngCoordinats.get(index))); } polygonOptions.strokeColor(0x7FFFFFFF); polygonOptions.strokeWidth((float) 5); polygonOptions.fillColor(Color.BLUE); polygon= mMap.addPolygon(polygonOptions); > polygonOptions.fillColor(Color.BLUE); is not working for me... What am i missing? read more
android
google-maps
polygons
4votes
1answer

Why is glibc's __random_r assigning variables it immediately overwrites?

I was looking for the source for glibc's rand() function, which an answer here links to. Following the link, I'm puzzled about the code for the __random_r() TYPE_0 branch: int32_t val = state[0]; val = ((state[0] * 1103515245) + 12345) & 0x7fffffff; state[0] = val; *result = val; What is [...] read more
c
random
glibc
4votes
1answer

how to implement the % operator for unsigned integer?

How to implement the % operator or function for lua's unsigned integer? I thought of using type cast to float, but precision is a problem. function ModU(a, b) if b == 0 then return a end if a == 0 then return 0 end if b < 0 then if [...] read more
lua
modulo
4votes
1answer

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

Recreating JS bitwise integer handling in Python3

I need to translate a hash function from JavaScript to Python. The function is as follows: function getIndex(string) { var length = 27; string = string.toLowerCase(); var hash = 0; for (var i = 0; i < string.length; i++) { hash = string.charCodeAt(i) + (hash << 6) + (hash << [...] read more
python-3.x
hash
integer
binary-operators
3votes
0answers

How >, >=, <, <= are implemented using only bitwise operations

I have seen this and this, from which at least the > is obtained as: int isGt(int a, int b) { int diff = a ^ b; diff |= diff >> 1; diff |= diff >> 2; diff |= diff >> 4; diff |= diff >> 8; diff |= diff [...] read more
bit-manipulation
comparison-operators
3votes
1answer

What is special in gcc about a loop that iterates 999 times?

BACKGROUND Using gcc 7.2 I found that the compiler output changes when a loop iterates 999 times. In particular this program (link to compiler explorer using gcc 7.2): int f() { int i=0x7fffffff-998; while (i+1>i) i++; return i; } compiles (using -O3 -fwrapv) to: f(): mov eax, 2147483647 ret but, [...] read more
c
gcc
3votes
6answers

Why/how does gcc compile the undefined behaviour in this signed-overflow test so it works on x86 but not ARM64?

I was self-studying CSAPP and got a strange result when I ran into a strange issue during the run of a assertion test. I'm not sure what to start this question with, so let me get the code first (file name visible in comments): // File: 2.30.c // Author: iBug [...] read more
c
gcc
x86-64
integer-overflow
arm64
3votes
2answers

Bitwise and (&) operator

I read that doing a & 0x7fffffff masks just the sign bit and doesn't tampers with the other bits. int a = Integer.MIN_VALUE; System.out.println(a & 0x7fffffff); But, this code outputs 0 instead of 2147483648 Why is that? read more
java
bit
operations
3votes
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
3votes
1answer

How to cast signed to unsigned int for 32-bit in php

I have tried to cast signed int to unsigned int for 32-bit in php. but i could not able to get the absolute value for the unsigned int. example: $value = 65547; if (PHP_INT_SIZE == 8) { if ($value>0x7FFFFFFF) { $value-=0x100000000; } } Is any other possibilities to cast signed [...] read more
php
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
2answers

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

printf and gcc -O option change return value

i'm trying to understand how gcc -O option and printf can change return value. in the code below isTmax is my function that return 1 if the input is the largest int value. int isTmax(int x); int main(void) { printf("%d\n", isTmax(0x7fffffff)); } int isTmax(int x) { int temp = x [...] read more
c
gcc
return-value
2votes
2answers

My perlin noise looks like wrong, almost like grey t-shirt material (heather). Why?

I tried a quick and dirty translation of the code here. However, my version outputs noise comparable to grey t-shirt material, or heather if it please you: #include <fstream> #include "perlin.h" double Perlin::cos_Interp(double a, double b, double x) { ft = x * 3.1415927; f = (1 - cos(ft)) * [...] read more
c++
random
perlin-noise
ppm
noise-generator
2votes
1answer

Perlin Noise 2D: turning static into clouds

I am trying to wrap my head around Perlin noise. This article has helped and I have been trying to recreate the cloud type images that it provides. My noise code is as follows: #include "terrain_generator.hpp" using namespace std; #define PI 3.1415927; float noise(int x, int y) { int n [...] read more
c++
opengl
perlin-noise
2votes
1answer

gcc takes much memory to compile c++ file with very large object on stack

I have a c++ file which uses a std::bitset<size>. When compiling using gcc on windows subsystem linux, if size = 1000000000 (1Gbit) cause about 1.6GB compile-time memory using, size = 10000000000 (10Gbit) cause about ~6GB memory and ~15GB virtual memory (my PC has 8GB memory in total). The memory is [...] read more
c++
gcc
memory
stack-overflow
2votes
1answer

How to fix "Dispatcher has no subscribers" error for a simple message producer?

I'm trying to create a simple JMS producer using Spring Integration. Can any one help me to explain why I'm getting "Dispatcher has no subscribers" error? I'm using ActiveMQ locally and based on my ActiveMQ log, both queue and session are created when I run my test application. But there [...] read more
java
spring-integration
spring-jms
2votes
1answer

Scikit - SGDRegressor doesn't fit

Hello I am trying to fit a small set of data using scilearn. import numpy as np from sklearn import linear_model, model_selection X = np.array([[86.5999984741211, 9.10000038146973, 14.3000001907349,1], [66.9000015258789, 17.3999996185303, 11.5,1], [66.3000030517578, 20 , 10.6999998092651,1], [78.6999969482422, 15.3999996185303, 12.1000003814697,1], [76.1999969482422, 18.2000007629395, 12.5,1], [84.4000015258789, 9.89999961853027, 12.1000003814697,1], [79.1999969482422, 8.5 , 10.1000003814697,1], [77.5 , 10.1999998092651, [...] read more
python
machine-learning
scikit-learn
linear-regression
2votes
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
2votes
2answers

Java Hex Number and Conditionals

I am new to Java so I have a problem with hex numbers usage in conditionals and its sizes. There is some issue about Scanner class too. I have searched java documents for primitive data types. The program is about; take a number and look in which data type it [...] read more
java
types
java.util.scanner
2votes
1answer

C# Search Byte Array inside Process Memory

I'm developing a little memory scanner for a specific application. When I select a process to scan, the first thing I want to do is to verify that the process is an instance that specific application... and to do this I must find a signature that can be anywhere inside [...] read more
c#
.net
pinvoke
readprocessmemory
2votes
2answers

Why the calculation of hash in HashMap(JDK1.8) don't need to consider the negative hashCode as ConcurrentHashMap does?

In HashMap: (h = key.hashCode()) ^ (h >>> 16); In ConcurrentHashMap: (h ^ (h >>> 16)) & HASH_BITS; where HASH_BITS is 0x7fffffff, by & HASH_BITS it can always be a positive number. read more
java
hashmap
concurrenthashmap
2votes
1answer

How to get a notification if a given process runs for longer than a specified time in Bash Linux?

I all goes well, my program finishes in about N seconds: ./maybe_deadlock But sometimes a deadlock happens randomly, and the program hangs forever. To debug this, I want to run the program along these lines: How to debug a rare deadlock? while true; do date gdb -ex 'set confirm on' [...] read more
bash
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
1answer

Can I do binary taint analysis?

I want to analyze the following binary. 4005e0: 55 push %rbp 4005e1: 48 89 e5 mov %rsp,%rbp 4005e4: 48 83 ec 10 sub $0x10,%rsp 4005e8: c7 45 fc 09 00 00 00 movl $0x9,-0x4(%rbp) 4005ef: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp) 4005f6: c7 45 f4 00 00 [...] read more
security
assembly
binary
analytics
dynamic-analysis
1vote
1answer

How to check value of variable is between MAX_INT and MIN_INT of 32 bit OS

I understand that all variables are of type strings. How can we check a variable value between MAX_INT(0x7FFFFFFF) and MIN_INT (-0x80000000) of 32 bit OS set var "12334" ...How to check var variable datatype and value range .. read more
tcl
1vote
2answers

How to use base32 in combination with hotp (one time passwords) in python?

for a university exercise I want to develop a simple hotp server-client system in python. In this case the client sends a password and a one time password to the server. The server knows the secret, calculates the current hotp and compares the values it receives. So far, so good. [...] read more
python
python-3.x
hmac
one-time-password
base32
1vote
0answers

How to upload large files through filestack?

When I try to upload a large file (+5GB) with the client.upload function of filestack-js in nodejs it throws an error: RangeError: File size is greater than possible Buffer: 0x7fffffff bytes I was using this SDK because I read that this allows to upload a large files through chunks but [...] read more
javascript
node.js
file
request
filestack
1vote
1answer

Implementing noise function in python from C code

I want to play around with procedural content generation algorithms, and decided to start with noises (Perlin, value, etc) For that, I want have a generic n-dimensional noise function. For that I wrote a function that returns a noise generation function of the given dimension: small_primes = [1, 83, 97, [...] read more
python
procedural-generation
1vote
1answer

SQL: Random sampling X% of samples(unique IDs) from duplicated ID table

I am using SQL and obtained the following table: userID| time | location A10 | 20130801| 1000 A10 | 20130802| 1002 A10 | 20130806| 1008 B21 | 20130803| 1000 B21 | 20130801| 1099 C11 | 20130802| 1000 D33 | 20130802| 1002 D33 | 20130806| 1877 E01 | 20130801| 1765 E01 [...] read more
sql
sql-server
1vote
4answers

SQL Query for Random 10% with a minimum of 20 rows

I have been tasked with generating a report that will randomly pick 10% of a unique ID, unless 10% is less than 20 items in which case the report would pick 20 random ID's. I have been using NewID to generate the 10%, but that really isn't the best as [...] read more
sql
sql-server
reporting-services
sql-server-2008-r2
ssrs-2008
1vote
2answers

Why does this implementation of Quadratic Probing fail when not overriding values on collision?

My current implementation of Quadratic Probing overrides the item being stored at the current index with the new item when a collision occurs. I insert three Person objects which are stored by using their lastname as key. To test the collision resolution of the implementation they all have the same [...] read more
java
hash
quadratic-probing
1vote
6answers

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

Why is .NET Dictionary FindEntry faster than simple loop?

I try to understand how .net C# Dictionary works. I always heard its search mechanism is fast. While looking at the implementation i saw the following code. The following is the FindEntry function as show in:MSDN implementation private int FindEntry(TKey key) { if( key == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key); } if [...] read more
c#
.net
performance
msdn
1vote
2answers

Why ConcurrentHashMap calculate hashcode with 0x7fffffff in 1.8?

When to calculate key's hashcode, spread() method is called: static final int spread(int h) { return (h ^ (h >>> 16)) & HASH_BITS; } where HASH_BITS equals 0x7fffffff, so, what is the purpose of HASH_BITS? Some one says it make the sign bit to 0, I am not sure about [...] read more
java
hashcode
concurrenthashmap
1vote
1answer

Spring integration testing flow with exception

I'm trying to test the flow, specifically when an exception is thrown, but for some reason I'm not getting anything in the errorsFromSend channel. Here is the gateway: @MessagingGateway public interface Send { @Gateway(requestChannel = "sending", headers = @GatewayHeader(name = "errorChannel", expression = "@errorsFromSend")) void send(final String s); } the [...] read more
unit-testing
error-handling
spring-integration
1vote
0answers

How to get RSCP, SINR and EcNo values in Android

I need to find RSCP, SINR and EcNo. So far i am able to calculate RSRP and RSRQ values from android.telephony.SignalStrength. My questions are: 1. When I try to get SignalStrength#getTdScdmaDbm() via reflection it returns Integer.MAX_VALUE (if i debug at line 300 its value is 0) According to AOSP RIL [...] read more
android
gsm
telecommunication
lte
cdma
1vote
1answer

Is this a static method, or something else?

I'm learning Dart so that I can do some flutter mobile development. Dart's pretty straightforward to learn and I like it, though there are a few differences from Java / C# that I have to work through. One of them has to do with this code: class CatalogSlice { final [...] read more
dart
1vote
1answer

Implicit Casting Issues (Integer literals)

I'm developing custom Int/UInt classes for larger integers. They work great with assignment/casting/arithmetic, etc. However, it exposed an issue that occurs with xunit and MSTest. Here's my code: UInt240 x = 0x7fffffff; Assert.Equal(0x7fffffff, x); The issue is that if I supply an unsigned type on the right side, and provide [...] read more
c#
casting
mstest
implicit
xunit
1vote
1answer

What is going on with this int to float conversion, why is it innacurate?

So I've basically got this code #include <stdio.h> int main() { int n = 0x7fffffff; float f = n; printf("%d\n", n); printf("%f\n", f); n = 0x00ffffff; f = n; printf("%d\n", n); printf("%f", f); } This gives this output: > 2147483647 > 2147483648.000000 > 16777215 > 16777215.000000 Why the difference between [...] read more
c
1vote
0answers

Google Authenticator For Objective C

I am developing an app that used Google Authenticator. For this scenario, The web application generate QRCode via Google Authenticator. And than i read this QRCode to generate OTP via Google Authentication in mobile app. I use below code to create OTP. When i check this created OTP is always [...] read more
objective-c
google-authentication
two-factor-authentication
authenticator
1vote
2answers

Receiving a "Error compiling: 0:1(1): error: syntax error, unexpected $end" C++, GLSL, shader files

Here is my shader.cpp. In my AddShader function, I am able to pass the vertex and fragment shader fine if it is hardcoded as a string with '\n' and '\' at the end of it. However when I try to load them from a file I receive the error in [...] read more
c++
opengl
glsl
1vote
2answers

Generating Alphanumeric OTP using HOTP

I understand that HOTP can be used to create numerical One Time Passwords. The algorithm behind being: > K be a secret key C be a counter HMAC(K,C) = SHA1(K ⊕ 0x5c5c… ∥ SHA1(K ⊕ 0x3636… ∥ C)) with ⊕ as XOR, ∥ as concatenation, (C is the message) Truncate [...] read more
cryptography
hmac
hmacsha1
1vote
1answer

Java source Hashtable

I don't known how to search this question, so I asked a question. Java version 1.7.0_80_x86 The remove method in java.util.Hashtable; I see that the value attribute of node e is set to null; However, e.next is not set to null; So if e.next is not null, will node e [...] read more
java
garbage-collection
hashtable
1vote
1answer

Translate embedded C function to PHP function

I'm trying to "translate" the following function written in C in PHP. The problem is, the results returned by the function written in PHP are different from those returned by the one in C. I think the problem comes from integer overflows in PHP which is not able to treat [...] read more
php
c
function
unsigned-integer
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
1answer

Divide by zero error from Colt OpenLongObjectHashMap

I saw this exception from Colt OpenLongObjectHashMap: java.lang.ArithmeticException: divide by zero at cern.colt.map.OpenLongObjectHashMap.indexOfKey(Unknown Source) at cern.colt.map.OpenLongObjectHashMap.get(Unknown Source) It's not reproduceable. This is indexOfKey: protected int indexOfKey(long key) { final long tab[] = table; final byte stat[] = state; final int length = tab.length; final int hash = HashFunctions.hash(key) & 0x7FFFFFFF; [...] read more
java
hashmap
divide-by-zero
compiler-bug
colt
0votes
1answer

Work on an array of signed int as if it contained unsigned values

I've inherited some old code that assumes that an int can store values from -231 to 2^31-1, that overflow just wraps around, and that the sign bit is the high-order bit. In other words, that code should have used uint32_t, except that it wasn't. I would like to fix this [...] read more
c
arrays
casting
signed
0votes
1answer

Limit to size of array type, while there's not yet an instance

I have the following minimal test program: struct Test { double contents [1000000000]; }; int main () { return 0; } It refuses to compile, even though the compiler cannot know wether I will instantiate Test statically, on the stack or on the heap. Why does the compiler complain? Are [...] read more
c++
arrays
windows
visual-c++
size
0votes
1answer

How to declare a vector of data

I'm doing an Assembly program in ArmV8 that uses multiple constants (in floating point) that are therefore multiplied by the a certain value (also in floating point). For that, I want to develop a loop that just went trought a vector that contained the constants, incrementing the address each time [...] read more
assembly
arm
arm64
armv8
0votes
1answer

How can I realize a Mars program while Extended (pseudo) instruction or format not permitted is deactivated using the Operation NOT, ADDI and ADDIU?

We have to extend our code. With these operations. Operations [https://i.stack.imgur.com/sWzCa.png] Ziel= destination register in line 14 im getting the error: line 14 column 2: Extended (pseudo) instruction or format not permitted. See Settings. When i comment line 14. (#not $9, $9) i get this errorline 27: Runtime exception at [...] read more
assembly
mips
mars
0votes
1answer

initializing values in Mars 4.5 getting an error

My homework is to initialize values in certain registers. We have to turn off Permit extended (pseudo) instructions and formats. When i try to assemble the code i get this error message for line 7,8,9 Extended (pseudo) instruction or format not permitted. Also is there a way to optimize the [...] read more
assembly
mips
mars-simulator
0votes
0answers

what does this 0x7fffffff mean in this function and where can i learn more about it

want to understand this and learn to implement it myself what does 0x7FFFFFF mean where can i look to learn more var secureRandom = function(count) { var rand = new Uint32Array(1) var skip = 0x7fffffff - 0x7fffffff % count var result if (((count - 1) & count) === 0) { [...] read more
javascript
0votes
4answers

Javascript - will this noise function work?

I have the following deterministic noise function which I've been using in a C# and C++ terrain generator for a while: float GridNoise(int x, int z, int seed) { int n = (1619*x + 31337*z + 1013*seed) & 0x7fffffff; n = (n >> 13) ^ n; return 1 - ((n*(n*n*60493 [...] read more
javascript
random
noise
0votes
1answer

I don't know why ArrayIndexOutOfBoundsException occur in Separate Chaining

I have a problem implementing Separate Chaining Hash. I made hash function as follows and expected to made hash value that is smaller than M. private int hash(K key) { return (key.hashCode() & 0x7fffffff) & M; } I don't know why I'm getting ArrayIndexOutOfException. When I tried to debug, I [...] read more
java
0votes
0answers

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
install
openai-gym
0votes
1answer

Interval schedule question about choose the same length of time from each interval

I was struggle with an interval schedule question, the question description as follow: > Description: Lanran has N friends. Every Sunday, Lanran has to play with his friends. The i-th friend can play with Lanran from time a to time b (a and b are included). However, Lanran has to [...] read more
c++
algorithm
intervals
schedule
greedy
0votes
1answer

How to make the android.widget.Scroller stop scrolling at a specific item index?

I'm experimenting with this project: https://github.com/maarek/android-wheel/blob/master/wheel-demo/src/kankan/wheel/demo/extended/PasswActivity.java I've been trying to implement the following: 1) set the wheel to land on the number 5 (or any other number) 2) scroll the wheel for about 2 seconds 3) after spinning stops (could be any number of rotations through 0 to 9) the [...] read more
android
0votes
1answer

Compute Shader not compiling for specific (valid) code

I'm experiencing weird behavior with conditional loops, branches and updating the UAV with my compute shader (DX11), CS 5.0. I'm t esting a naive raymarching through Sparse Voxel Octtree bricks. The data is linearised by BFS. The structure (LWSVO = Light Weight SVO) looks like: struct LWSVO { int firstChild; [...] read more
directx
shader
hlsl
0votes
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. But now I found a pointer in a 32bit program (using Cheat Engine) which is pointing to an address which [...] read more
windows
pointers
system
cheat-engine
0votes
0answers

VirtualAlloc2 with MemExtendedParameterAddressRequirements always produces ERROR_INVALID_PARAMETER

I am trying to use VirtualAlloc2 with MemExtendedParameterAddressRequirements to allocate memory to specific regions of address space. This is my first time using this new API but I haven't been able to ever get it to succeed. It always returns nullptr and GetLastError is ERROR_INVALID_PARAMETER. Here is a minimal example, [...] read more
winapi
0votes
1answer

How can I add my treat node in multiple places throughout the game?

I want to have about 15 treats and I just want to change the x position of these treats. I don't want to copy and paste this code 15 times, so how can I go about doing this? func createTreatNode() { let atlas = SKTextureAtlas(named: "Treat") let q1 = atlas.textureNamed("treat1.png") [...] read more
swift
xcode
sprite-kit
skspritenode
0votes
1answer

Using AND instruction with 32-bit operand in 64-bit

I have a question on the AND instruction in 64-bit mode. I have this manual telling me that the AND 32-bit immediate is to be sign-extended to 64-bit. But I can't do this and rax,0x80000000 Which is ridiculous I think because 0x800000 is a perfect DWORD operand. The highest I [...] read more
assembly
x86
size
x86-64
operands
0votes
3answers

Why do C compilers not warn when assigning integer value too high for signed type?

(assuming 64bit machine) e.g. int n = 0xFFFFFFFF; //max 32bit unsigned number printf("%u\n", n); The maximum positive number that a regular signed integer (32bit) can store is 0x7FFFFFFF. In the above example I'm assigning the maximum unsigned integer value to a regular signed integer, I'm receiving no warnings or error [...] read more
c
integer
unsigned-integer
0votes
1answer

How does the _mm_cmpgt_epi64 intrinsic work

I'm using the _mm_cmpgt_epi64 intrinsic to implement a 128-bit addition, and later a 256-bit one. Looking at the result of this intrinsic something puzzles me. I don't understand why the computed mask is the way it is. const __m128i mask = _mm_cmpgt_epi64(bflip, sumflip); And here's the output in my debugger: [...] read more
x86-64
sse
simd
intrinsics
sse4
0votes
1answer

Why does toHexString have variable length?

Why is it that toHexString prints different strings in what appears to be very specific circumstances? Printing a number below 0x80000000 works just fine. Adding 1 to that value and printing it works fine. But assigning that value directly does not print the same thing, instead I have to add [...] read more
java
type-conversion
hex
0votes
0answers

custom Oreo kernel: SysRq: Emergency Remount R/O

I build a custom kernel for a mt6735m x32 device. My aim is to make it support project treble. Therefore i created a vendor partition and modified the stock kernel. I am now stuck at a point where i don't know how to go on: When booting up, i am [...] read more
kernel
android-8.1-oreo
0votes
2answers

Stray characters seen at output of snprintf

I have a string creating function in C which accepts an array of structs as it's argument and outputs a string based on a predefined format (like a list of list in python). Here's the function typedef struct { PacketInfo_t PacketInfo; char Gnss60[1900]; //and other stuff... } Track_json_t; typedef struct [...] read more
c
arm
embedded
0votes
2answers

unable to configure NSURLCache with more than 2GB discCapacity

I am trying to configure NSURLCache with the maximum disc capacity possible. I'm on iOS 7. according to the docs, NSURLCache's discCapacity attribute is a NSUInteger, aka unsigned int, which should accept a maximum value of 4,294,967,295 (0xFFFFFFFF). However, using any value above 0x7FFFFFFF (2147483647) results in the value actually [...] read more
ios
afnetworking
cfnetwork
nsurlcache
0votes
0answers

Are different program share the same kernel space?

For windows operating system, I understand that each user application's memory space is divided into two part: user space and kernel space. User space is from 0x00000000 to 0x7fffffff. Kernel space is from 0x80000000 to 0xffffffff. My question is: are different programs (user application) share the same kernel space content? read more
windows
kernel
0votes
1answer

ListView: NotifyCollectionChangedEventHandler always raises ArgumentOutOfRangeException

I have a ListView control which I load asynchronously (by setting ListView.ItemsSource) using a collection class that implements ISupportIncrementalLoading / INotifyCollectionChanged. When I attempt to invoke the INotifyCollectionChanged event subscriber, I get ArgumentOutOfRangeException "This collection cannot work with indices larger than Int32.MaxValue - 1 (0x7FFFFFFF - 1).\r\nParameter name: index" exception. [...] read more
c#
uwp
0votes
1answer

Reconnecting a Bluetooth device using socket library (RFCOMM mode) in python 3?

I am trying to connect to a Bluetooth GPS unit from a Raspberry Pi3 using the socket library in python 3. I am able to connect and get data flowing the first time but if I disconnect and then try reconnecting I get: > [Errno 16] Device or resource busy [...] read more
python
sockets
bluetooth
raspberry-pi3
rfcomm
0votes
1answer

Tensorflow: JRE Fatal error (SIGILL (0x4)) at loading _clustering_ops.so

Created a test java application which loads a trained python model through Tensorflow. Had to add the below line to fix this exception "Op type not registered 'NearestNeighbors' in binary" TensorFlow.loadLibrary(/tmp/path/to/_clustering_ops.so); My application runs with no issue on my computer. However, when running the application on a server, the application [...] read more
tensorflow
gdb
0votes
3answers

isGreater bitwise C manipulation - greatest of two numbers

Bitwise manipulation and I have to find the greatest of two numbers. 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
bit-manipulation
0votes
2answers

Google Authenticator Counter Based OTP

Hi I am using Counter based OTP with HOTPAlgorithm which is as below. When I try to generate code using google authenticator App by entering same secret key as of my server,its produce different code than my actual server side code which is generate by below algorithm.Please help. import java.io.UnsupportedEncodingException; [...] read more
security
google-authenticator
0votes
5answers

Bitwise Arithmetic in C: Checking if a number is positive

x is an int, I should be able to get the correct result when 0 is not involved. In attempts to account for the 0 case, I added "& x", which I believe now should return that a number is positive iff x > 0 and x is not 0 [...] read more
c
math
bit-manipulation
0votes
1answer

Comparison const int in ndk 17.0.4

I have a issue about comparision const int below. AK_FORCE_INLINE static int intArrayToCharArray(const int *const source, const int sourceSize, char *dest, const int destSize) { // We want to always terminate with a 0 char, so stop one short of the length to make // sure there is room. const [...] read more
android
c++11
android-ndk
comparison
0votes
2answers

Modify ALSA arecord function to output audio levels to Raspberry Pi 3 RGB LED

I currently can use my raspberry pi 3 to redirect USB Audio input to an icecast stream. Currently it works fine in small tests when I pipe arecord from USB audio hw input to avconv (ffmpeg equivalent) on Raspbian Jessie Lite. Arecord has a built in text vu meter for [...] read more
c
debian
raspbian
alsa
raspberry-pi3
0votes
0answers

How to read memory address over ram size in python

I want to read some register from /dev/mem, and here is the sample code import os, sys fd = os.open("/dev/mem",os.O_RDWR) #0xFED01004 = 4275048452 os.lseek(fd, 4275048452, os.SEEK_SET) ret = os.read(fd,2) print ret os.close(fd) print "close" But my ram size is 2 GB(0x7FFFFFFF) and it's less than 4275048452. It will get bad [...] read more
python
c
linux
memory
embedded-linux
0votes
1answer

Ruby's Mechanize Error 401 while sending a POST request (Steam trade offer send)

I'm trying to send a steam trading offer using mechanize, I do the log-in get the required cookies but when I try to send a steam trading offer I receive error 401 Unauthorized. I ported this code from python there only difference there is ,as far as I can see, [...] read more
ruby
mechanize
-1votes
2answers

invalid use of member ‘xx::x’ in static member function

I want to apply selection operation in a 3d viewer (using qt-creator) any.h file: #include <GL/gl.h> #include <GL/glu.h> #include <stdlib.h> #include <stdio.h> #include <GL/glut.h> class any { public: any(); int board[3][3]; void init(void); static void drawSquares(GLenum mode); static void processHits (GLint hits, GLuint buffer[]); static void pickSquares(int button, int state, [...] read more
c++
qt
compiler-errors
computational-geometry
-1votes
2answers

How to print 8 Byte void pointer (including chars) as hex

I am currently trying to print out data, captured by the SSH Wireshark dissector. I debugged the void pointer array which I need and in the debugger the first index looks as follows: [0] 0xa9ac1405c4040000 void * [1] 0xc4c2f211de8a3e38 void * However when i try to print the stuff the [...] read more
c
pointers
printing
-1votes
2answers

Error 1 error C2148: total size of array must not exceed 0x7fffffff bytes I get this Error in C

I want to make a char[1 048 576][16 384][1024] and a int [1 048 576][16 384] but I get an Error! I want to make an 3d array as big as excel can handle! read more
c
arrays
-1votes
2answers

How to fix mentioned MISRA-2012 10.4 and 10.9 violations issue in this code?

There are required pieces to formulate my problem. Below are content of MyError.h header file. -------------------------------------------------------------------------------- MYERROR.H ########################### # myError.h ########################### 1 typedef enum 2 { 3 MySuccess = 0x00000000, 4 MyError1 = 0x00000001, 5 MyError2 = 0x00000003, 6 MyForce32 = 0x7FFFFFFF 7 } MyError; 8 #define PROPAGATE_ERROR_FAIL_MY_1(_err) \ 9 [...] read more
c
misra
safety-critical
-1votes
1answer

Php function calling

I have this function: public function getCode($secret, $timeSlice = null) { if ($timeSlice === null) { $timeSlice = floor(time() / 30); } $secretkey = $this->_base32Decode($secret); // Pack time into binary string $time = chr(0).chr(0).chr(0).chr(0).pack('N*', $timeSlice); // Hash it with users secret key $hm = hash_hmac('SHA1', $time, $secretkey, true); // Use [...] read more
php
-1votes
1answer

Linux kernel not able to mount rootfs from USB

I am using Intel Joule 570x board for reference which has 64-bit x86 architecture. I am using GRUB2 as the bootloader and mainline kernel 4.9. I built the kernel, also busybox rootfs and then tested them on qemu and I can boot to shell. Now I put the kernel bzImage, [...] read more
linux
kernel
usb
boot
grub2
-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
4answers

C find maximum two's complement integer

I am tasked with finding maximum two's complement integer, or the TMax. I am at a complete loss for how to do this. I know that the correct value is 0x7fffffff, or 2147483647, but I do not know how exactly to get to this result. That's the maximum number for [...] read more
c
binary
twos-complement
-2votes
1answer

How to generate random integers 0 to 0x7FFFFFFF?

This doesn't work: for (int p = 0; p < 10; p++) { random_device rd; mt19937 gen(rd); uniform_real_distribution<int> dis(0, INT_MAX); printf("%i\n", dis(gen)); } Any advice would be appreciated. read more
c++
visual-studio
windows-10
-3votes
2answers

Is It Possible for a number that is greater than Integer.MAX_VALUE for both Integers?

int x = ?; if(x > Integer.MAX_VALUE) { System.out.println(x); } when the above condition gets true??? what is the value of x? Integer.MAX_VALUE = 0x7fffffff, I tried x with 0x80000000 in hexa decimal. But x is now negative number. read more
java

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