int

PHP: Variable is int but can't perform calculation

$bal = (int)$balance; echo is_int($bal); $balance is from a file_get_contents($webservice); I am using (int) to convert a string to integer. is_int returns 1 for true as verification. Because the value of $bal is always negative, I do the following calculation to make it a positive: $bal = $bal * -1; When I do this, the value bec...

Which API can I use to format an int to 2 digits?

What API can I use to format an int to be 2 digits long? For example, in this loop for (int i = 0; i<100; i++) { System.out.println("i is " + i); } What can I use to make sure i is printed out like 01, 02, 10, 55 etc (assuming a range of 01-99 ) ...

How can I convert a string to an int in Python?

Possible Duplicates: Python - Parse String to Float or Int How can I convert a string to an int in Python? The output I'm getting for my little example app is the following: Welcome to the Calculator! Please choose what you'd like to do: 0: Addition 1: Subtraction 2: Multiplication 3: Division 4: Quit Application 0 Enter yo...

How can I convert a string to an int in Python?

The output I'm getting for my little example app is the following: Welcome to the Calculator! Please choose what you'd like to do: 0: Addition 1: Subtraction 2: Multiplication 3: Division 4: Quit Application 0 Enter your first number: 1 Enter your second number: 1 Your result is: 11 This is because the addition() method is taking the ...

mysql order by integer and varchar

I got a field with sizes(VARCHAR). The sizes can have int and string values, e.g. (1, 2, 3-4, X, XL, M, ...). When i use the normal order by function of mysql the output is the following: 1,10,11,2, 44-46, L, M, S, XL, XXL The values that does not contain a number are sorted as i want to do it. (I know that the values are sorted as a str...

Converting a 2d array of ints to char and string in Java

How can i convert the ints in a 2d array into chars, and strings? (seperately) If i copy ints to a char array i just get the ascii code. For example public int a[5][5] //some code public String b[5][5] = public int a[5][5] Thanks ...

Conversion failed when converting the varchar value to int

I'm getting an error with what should be a simple query to insert data. I've done searching, but for the life of me, I cant figure out whats happening. Here's my SQL: IF OBJECT_ID('settings') IS NOT NULL DROP TABLE [settings] CREATE TABLE [settings] ( [id] [bigint] IDENTITY(1,1) NOT NULL PRIMARY KEY, [tenant_id] [bigint] NOT ...

How do you generate a random double between these points?

37.807614 to 37.786996 The randomly generated double must have the same precision (num of digits) as those above. For example, 37.792242 would be good, whereas 37.7823423425 would be bad. ...