integer

Integers in TextNodes w/ Python minidom

I am working on an API using SOAP and WSDL. The WSDL expects integers to come through. I am fairly new to ALL of this, and constructing XML in Python. I have chosen to use minidom to create my SOAP message. So using minidom, to get a value into a node I found I have to do this: weight_node = xml_file.createElement("web:Weight") weight...

[Python]String and integer concatenation

Hi, I want to create string in a for. # Create string0, string1 ..... string10 for i in range [1,10]: string="string"+i But I have returned an error because i is not a string but integer. How I can do it? Thanks. ...

strcmp equivelant for integers (intcmp) in PHP

So we got this function in PHP strcmp(string $1,string $2) // returns -1,0, or 1; We Do not however, have an intcmp(); So i created one: function intcmp($a,$b) { if((int)$a == (int)$b)return 0; if((int)$a > (int)$b)return 1; if((int)$a < (int)$b)return -1; } This just feels dirty. What do you all think? this is par...

Do I get an Integer or int after putting an int into an object array?

Would (1) int a; new Object[] {a} be the same as (2) new Object[] {new Integer(a)} ? If I do the 1st one, will (new Object[]{a})[0] give me an Integer? thank you ...

View problem - how to show integer from activity in XML?

Hi there, I started two days ago with android, gone through the hello android stuff and also started to read the Hello Android book, which is great. PROBLEM: I use in my app - VERY EASY APP- the XML output. So basically the main activity just tells the android to show the XML layout of main. But what if I have in the activity - code ...

Intger encoding and decoding problem

I have a long list of integers, and i need to reduce this down to a single integer. The integer list can be anywhere from 0 to 300 ints long (about). I need to be able to encode/decode. Is there a better option than a lookup table? ...

Correctly assigning value to a Core Data attribute with an integer data-type

I'm missing something here, and feeling like an idiot about it. I'm using a UIPickerView in my app, and I need to assign the row number to a 32-bit integer attribute for a Core Data object. To do this, I am using this method: -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { ...

Possible loss of precision / [type] cannot be dereferenced

I have been looking around a lot but i simply can't find a nice solution to this... Point mouse = MouseInfo.getPointerInfo().getLocation(); int dx = (BULLET_SPEED*Math.abs(x - mouse.getX()))/ (Math.abs(y - mouse.getY()) + Math.abs(x - mouse.getX()))* (x - mouse.getX())/Math.abs(x - mouse.getX());...

C#: How can I make an integer negative?

Hi, How can I make an integer negative in C#? abc = 5645307; // how to make abc -5645307 ? ...

C/C++ - Convert 24-bit signed integer to float

I'm programming in C++. I need to convert a 24-bit signed integer (stored in a 3-byte array) to float (normalizing to [-1.0,1.0]). The platform is MSVC++ on x86 (which means the input is little-endian). I tried this: float convert(const unsigned char* src) { int i = src[2]; i = (i << 8) | src[1]; i = (i << 8) | src[0]; ...

Why is it inserting 0's instead of blank spaces into my DB using php?

I have an insert: $sql = 'INSERT into orders SET fax_int_prefix = "'.$_SESSION['fax_int_prefix'].'", fax_prefix = "'.$_SESSION['fax_prefix'].'", fax_first = "'.$_SESSION['fax_first'].'", fax_last = "'.$_SESSION['fax_last']; The value of all of these fields is that they are blank right before the insert. Here is an example of one o...

Is there a standard format string in ASP.NET to convert 1/2/3/... to 1st/2nd/3rd...?

I have an integer in an Access database, which is being displayed in ASP.NET. The integer represents the position achieved by a competitor in a sporting event (1st, 2nd, 3rd, etc.), and I'd like to display it with a standard suffix like 'st', 'nd', 'rd' as appropriate, rather than just a naked number. An important limitation is that thi...

php encrypting an integer to get only alphanumeric characters?

When I use some of php's encryption functions, I end up getting a few characters I don't want (+, /, =). The problem is that my application doesn't allow these in the url. I'm wondering if there's a good way of encrypting an integer and having only alphanumeric characters in the result? I'm trying to pass some data through the url. I kno...

Does some Integer data types differnate with other Programming languages?

Do Integer data types allow spaces when it should be just numeric? Do other programming languages allow spaces in an Integer data type? For example, MySQL database storage does not allow spaces to be stored in an int data type. Do other languages allow it when storing in their own int type? ...

Best way to handle Integer overflow in C#?

Handling integer overflow is a common task, but what's the best way to handle it in C#? Is there some syntactic sugar to make it simpler than with other languages? Or is this really the best way? int x = foo(); int test = x * common; if(test / common != x) Console.WriteLine("oh noes!"); else Console.WriteLine("safe!"); ...

Are these two functions the same?

There is a function in the AES algorithm, to multiply a byte by 2 in Galois Field. This is the function given in a website private static byte gfmultby02(byte b) { if (b < 0x80) return (byte)(int)(b <<1); else return (byte)( (int)(b << 1) ^ (int)(0x1b) ); } This is the function i wrote. private st...

Problem getting size of Website Xcode

When i try and compile I come up with a warning that reads initialization makes pointer from integer without a cast. No clue why. I am just trying to get the size of a website. #import "Lockerz_RedemptionViewController.h" @implementation Lockerz_RedemptionViewController -(IBAction)startLoop:(id) sender { NSData *dataNew = [NSDat...

Integer Types in file formats

Hi, I am currently trying to learn some more in depth stuff of file formats. I have a spec for a 3D file format (U3D in this case) and I want to try to implement that. Nothing serious, just for the learning effect. My problem starts very early with the types, that need to be defined. I have to define different integers (8Bit, 16bit, 3...

How can I use cout<<myclass?

myclass is a c++ class writed by me . and when I write myclass x; cout << x; // how to output is " 10 " or "20" like intger or float value ...

Looking for more details about "Group varint encoding/decoding" presented in Jeff's slides

I noticed that in Jeff's slides "Challenges in Building Large-Scale Information Retrieval Systems", which can also be downloaded here: http://research.google.com/people/jeff/WSDM09-keynote.pdf, a method of integers compression called "group varint encoding" was mentioned. It was said much faster than 7 bits per byte integer encoding (2X ...