int

xcode defining variable problem

Hi there Can someone please explain to me why my variable called activity is 0 when defined as a float, but displays the correct value when defined as an int? I have another float which is used for pretty much the same thing but works perfectly! @implementation AppPrefsViewController float age; int activity; ... -(void) updateAValues...

How do I convert a hexidecimal color (with alpha) to an int in Jython?

Hi, I need to convert an ARGB hex into an int in Jython for color. I've tried using longs, hex() and a combination of other things and can't seem to get it to work. I get this error "TypeError : 5th arg can't be coerced to int" when I try to convert 0x80ff3333 to an int. I guess there are too many bytes in the hex to convert it. Anyon...

How do I convert a string into an integer in objective C?

I am trying to convert a user's guess into an integer. How do I do that? ...

Storing big int array partially in database , to reduce memory in java

Hi Experts, I have a class that has int[] members. The arrays grow very big, about 56M in size.(arrays are expandable with implementation similar to arraylist). Now I want to partially store the array in database, to improve memory. I have oracle database at my disposal. I would also like to cache more used indexes. I am wondering if ...

convert string into signed int

I want to convert a string into a signed int. Following is the requirement. I have stored hex value as a string in buffer. Now I want to convert that value into signed int. buf = "fb869e" Convert this into signed int. So o/p should be -293218. but when I'm trying to convert using strtol I'm getting 16483998. So what I should I do? ...

Convert boolean to int in Java

What is the most accepted way to convert a boolean to an int in Java? ...

Prefix '0' to the int variable which less than '10', How?

Is there any simple method to concatenate '0' before an int variable. Like: int i = 2; // produce i = someMethod(i); // output: i = 02 ...

Trying to use reflection to find the first Int32 property of a class

Hi folks, I'm trying to find the first property of a class that is an Integer .. and get it's value. So i've got the following code .. which always returns false: foreach(var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { var someType = property.PropertyType is int; // Always false. } Why is ...

Increment a Integer's int value?

How do I increment a Integer's value in Java? I know I can get the value with intValue, and I can set it with new Integer(int i). playerID.intValue()++; does not seem to work. Note: PlayerID is a Integer that has been created with: Integer playerID = new Integer(1); ...

int v/s. long in C

On my system, I get: sizeof ( int ) = 4 sizeof ( long ) = 4 When I checked with a C program, both int & long overflowed to the negative after: a = 2147483647; a++; If both can represent the same range of numbers, why would I ever use the long keyword? ...

How to check whether a int is not null or empty?

I really dont know this is possible or not. But I am strucking in a place where i want to check a int value is null or not, to call different methods. Is there any way to do it? Actually that variable comes from a browser with a null value. I cannot change the int declaration to Integer. Because it has it own consequences. Any suggest...

NSCoding and integer arrays

How do you use NSCoding to code (and decode) an array of of ten values of primitive type int? Encode each integer individually (in a for-loop). But what if my array held one million integers? Is there a more satisfying alternative to using a for-loop here? Edit (after first answer): And decode? (@Justin: I'll then tick your answer.) ...

C# Error: Error converting nvarchar datatype to int. HELP!

Hello everyone, i'm having a really hard time with my c# application. Everytime i run the code below, it gives me an error about the convertion of nvarchar datatype to int. I have tried casting but it doesn't seem to work. ConnectionString myConnString = new ConnectionString(); string connString = myConnString.getConnectionString(); Sq...

Unsigned Overflow in C

Consider the following piece of C code: #include <stdint.h> uint32_t inc(uint16_t x) { return x+1; } When compiled with gcc-4.4.3 with flags -std=c99 -march=core2 -msse4.1 -O2 -pipe -Wall on a pure x86_64 system, it produces movzwl %di,%eax inc %eax retq Now, unsigned overflow is predicted in C. I do not know much about x86_64...

How do I convert an int to two bytes in C#?

How do I convert an int to two bytes in C#? ...

Determining sprintf buffer size - what's the standard?

When converting an int like so: char a[256]; sprintf(a, "%d", 132); what's the best way to determine how large a should be? I assume manually setting it is fine (as I've seen it used everywhere), but how large should it be? What's the largest int value possible on a 32 bit system, and is there some tricky way of determining that on th...

Java int to String - Integer.toString(i) vs new Integer(i).toString()

Sometimes java puzzles me... I have a huge amount of "int" initializations to make. What's the "real" difference? Integer.toString(i) new Integer(i).toString() Thanks. ...

converting 'int' to 'long' or accessing too long array with 'long'

hi, let say i have an array that is long enough to access any of its index with int, is there any way to access the index of such an array with long? and how the java handles this kind of array? e.g. int[] a = new int[]{1,5,2,4........9,2,1} assume in above array that 9,2,1 are at indices that are beyond the range of int (2^32). how ...

Singleton Integer Issue

Hi I have a singleton which I hold a single integer in, my score. However when I load it form the singleton in a another view it doesn't show what I want but instead sticks at a wired 6592960. Any ideas why? Something to do with how I am using @property Im thinking, what the correct way to @property an int? Thanks. EDIT: Code: Singlet...

Save a set of integers iPhone

Hi In my game I want to save a set of integers as statistics players can view. E.g number of deaths. This is an int I simply increase by one each time they get a game over. How can I save this then have it at that number when I relaunch the game? Thanks. EDIT: Ok after reading a few answers Im thinking writing to a plist is the way ...