Python 3: RuntimeWarning with numpy.power

When using numpy.power(2,N), where N is an integer, I encounter the following issue: In[1] np.power(2,63) Out[1] -9223372036854775808 RuntimeWarning: invalid value encountered in power and even more strangely, In[2] np.power(2,63)*2 Out[2] 0 Th...
more »

2017-09-18 19:09 (1) Answers

Integer concenation with macro

How to concenate integer correctly with macro ? I must call it twice here because i can't add something after ","(error) #define concat(a,b,c) a##b##c dim as integer a=10,b=20,c=30,d d = a concat(*100+,,)b d = d concat(*100+,,)c ?d 'output = 102030...
more »

2017-09-18 05:09 (0) Answers

Integer overflow test operator? (&+)

This question could just be another case of interpreting the operator incorrectly. But a while ago, I saw someone tweeting about an operator that allegedly can be used to check for integer overflow in C. Namely the &+ (ampersand-plus) operator, a...
more »

2017-09-17 23:09 (3) Answers

How to make global empty integer?

How to declare global empty integer? I have simple code but i don't know how to declare a variable before def. In java I can do just that: public int a; but how to do it in python? Without this, the third if not working My code: def abcd: if s<...
more »

2017-09-16 01:09 (4) Answers

Convert text to integer to compare in C#

The C# program receives a string labeled: 1.2345 V I need to compare this value using < or > in a 'if' statement. How do I convert the string above to a integer? I tried to use: int anInteger; anInteger = Convert.ToInt32(textBox1.Text); anInt...
more »

2017-09-15 15:09 (3) Answers

Round Only Percentages to Nearest Multiple of 5

I have a CSV file that contains some values. I need to round only each of the percentages in the text file, to the nearest integer of 5. file 25,83%,22%,67%,43%,30,18%,2,11% awk Code: awk '{for (i=1; i<=NF; i++) $i = int( ($i+2) / 5) * 5 "%" ...
more »

2017-09-15 12:09 (0) Answers

Round Numerical Values to Nearest Multiple of 5

I have a text file with one line of percentages. I need to round all of the numbers in the text file to the nearest integer of 5, for example... 4 rounds up to 5, 8 rounds up to 10, 12 rounds down to 10, 17 rounds down to 15, etc... Text File: 25%...
more »

2017-09-15 11:09 (4) Answers

JSlider only takes integers

I think I've got a hard question... I have programmed a Musicplayer and I have a JSlider at a JFrame as a progress-bar for each song. He is adding every second the current time of the song multiplied by the lenght of the slider which is divided by th...
more »

2017-09-14 19:09 (0) Answers

Finding Amount of Divisors

I need to write a function in #lang racket that determines the amount of divisors a positive integer has. (Ex: 6 has 4 divisors; 1,2,3,6) So far I have: (define (divides a b) (if (= 0 (modulo a b)) #t #f)) I need to use this helper function to...
more »

2017-09-14 16:09 (1) Answers

Get Integer list from one file

This script checks skills from the config file and allows using only them (in order stop hacking). Here is the process of how to work my script works: #1 There is special .ini configuration file with this skill list: CommunityAvailableBuffs = 115...
more »

2017-09-08 07:09 (2) Answers

how to get sum in jtable colmn

I'm trying to build my app and I need to get the sum of my jtable 5th column value, I used this code: public int getsum(){ int sum = 0; for (int i=0; i<jTable2.getRowCount(); i++) { sum = sum + Integer.parseInt(jTable2.getV...
more »

2017-09-05 13:09 (1) Answers

CSV Import Decimal in Integer Access

I have to import a .CSV into Access on a daily basis. One of the fields is causing problems. The value is stored as '5,000'. This is not '5 point 0', but '5000' (five thousand). I've tried multiple combinations of decimal symbols and data types but...
more »

2017-09-05 13:09 (3) Answers

Algorithm to classify 10 digit keys

I'm looking for an algorithm that classifies differently formated 10 digit (mostly) integer keys. The training data set looks like that: +------------+----------------+ | key | classification | +------------+----------------+ | 1000012355 | U...
more »

2017-09-04 21:09 (2) Answers

Trouble with the poisson model-integer number

I'm having trouble with the running of a log-log regression model with Poisson. How should I prevent this warning message? It's also the first time that I use Poisson so I really don't know how to do. Thanks a lot sardegnalog.lm <-glm(log1p(fulld...
more »

2017-09-04 17:09 (1) Answers