integer

Python Class with integer emulation

Given is the following example: class Foo(object): def __init__(self, value=0): self.value=value def __int__(self): return self.value I want to have a class Foo, which acts as an integer (or float). So I want to do the followng things: f=Foo(3) print int(f)+5 # is working print f+5 # TypeError: unsupported op...

c++ - convert pointer string to integer

I am trying to convert treePtr->item.getInvest() which contains a string to an integer. Is this possible? ...

objective-C : @synthesize not working and basic operations not working :*(

I am unsure why this code will not work and what i want it to do is when i click a button(action: buttonclick) i want it to change the two text box's(MyTextLabel & MyTextLabel2) text increment the value "r" by one. here is the code: MainView.h #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> @interface MainView : UIView { ...

Conversion from string "" to type 'Integer' is not valid.

When I try to run the following code I get a Conversion from string "" to type 'Integer' is not valid. error. Dim maj = (From c In connect.Courses _ Where c.COTRequired = CBool("True") _ Select c.CourseID, c.CourseName, c.CreditHours).Except _ (From en In connect.Enrollments ...

Pseudorandom Sequence Generator not just a number generator.

I need an algorithm that pretty much will turn a unix timestamp into a suitably random number, so that if I "play back" the timestamps I get the same random numbers. And here's what I mean by suitably: Most humans will not detect a loop or pattern in the random numbers. It need not be cryptographically secure. All numbers must be capa...

Storing ints in a Dictionary

As I understand, in Objective-C you can only put Objects into dictionaries. So if I was to create a dictionary, it would have to have all objects. This means I need to put my ints in as NSNumber, right? SOo... NSNumber *testNum = [NSNumber numberWithInt:varMoney]; NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] i...

How to convert Integer to Date in JSP page and then format that Date ?

I get following varaiable, but I cannot format Integer, so is there any way to convert Integer to Date in JSP page? <fmt:formatDate value="${c.dateInIntegerValue}" pattern="dd.MM.yyyy hh:mm"/> ...

Why does this code in VBA Power Point work fine witout Dim commands for numbers?

From one of VBA tutorials I learned that variables contining numbers should be firstly declared as integers: Dim mynumber as integer But, please, look at this code: Sub math() A = 23 B = 2 ABSumTotal = A + B strMsg = "The answer is " & "$" & ABSumTotal & "." MsgBox strMsg strMsg = "The answer is " & "$" & Sqr(AB...

MySQL integer unsigned arithmetic problems?

Does MySQL (5.0.45) like to do strange internal typecasts with unsigned maths? I am storing integers unsigned but when selecting basic arithmetic I get outrageous numbers: mysql> create table tt ( a integer unsigned , b integer unsigned , c float ); Query OK, 0 rows affected (0.41 sec) mysql> insert into tt values (215731,216774,1.580...

Sending an int over TCP (C-programming)

Hi! I have a server and a client program (both running on the same machine). The client is able to send a struct to the server with members such as "ID", "size" etc. Then I would like the server to send the ID-member (just an integer) back to the client as an ACK for validation, but I just can't figure this out despite being able to sen...

Performance of 32-bit integers in a 64-bit environment (C++)

We've started compiling both 32- and 64-bit versions of some of our applications. One of the guys on my project is encouraging us to switch all of our 32-bit integers to their 64-bit equivalents, even if the values are guaranteed to fit in a 32-bit space. For example, I've got a value that is guaranteed to never exceed 10,000 which I'm...

C# testing to see if a string is an integer?

Hi, I'm just curios as to whether there is something built into either the c# language or the .net framework that tests to see if something is an integer if (x is an int) // Do something It seems to me that there might be, but I am only a first-year programming student, so I don't know. ...

NoReverseMatch in django

Hi. After debugging for a while I found what the error was, but I don't know how to fix it. I have an urlConf whit the name 'ver_caja' who receives as argument the id of a caja object, and then call the generic object_detail. The queryset is correct: get all the caja objects correctly. In the template I have the call: {% ver_caja caja...

Objective-C - Comparing integers not working as expected

Hi everyone. So my problem is this: I am receiving a JSON string from across the network. When decoded (using SBJSON libraries), it becomes an NSDictionary that SHOULD contain a number of some sort for the key 'userid'. I say 'should' because when I compare the value to an int, or an NSINTEGER, or NSNumber, it never evaluates correctly....

Axapta: force container integer to be stored as a string

Is there a way to force a container to store all values as strings? I am using str2con in order to split text strings into containers. Any time a field with numbers only comes up, it is stored as an int, which isn't a huge problem. What IS a big problem is when the string of numbers exceeds the integer size and the number becomes somet...

[iphone DEV] makes pointer from integer without a cast

Hello, i have a simply warning in my iphone dev code. NSUInteger *startIndex = 20; This code work, but i have a warning : warning: passing argument 1 of 'setStartIndex:' makes pointer from integer without a cast Thanks for your help. ...

How to display integers in messagebox in Visual C#?

I am trying to use a messagebox to debug a Visual C# program. When I click a button I want a simple messagebox to popup and display the values of several integer variables. This is what I have System.Windows.Forms.MessageBox.Show(myGame.P2.Money); However the variable Money is an integer, and so I get this error: Argument '1': cann...

Displaying the size of a file in CListCtrl

I am working in Windows MFC application..In my design am displaying the file details (type,name,size) in a CListCtrl control. I found those file details using FileStatus but when I try to display, I am not able to display the file size since its an integer. I tried CListCtrl::SetItemText and I also tried to type cast but its not working....

Hashing function for four unsigned integers (C++)

I'm writing a program right now which produces four unsigned 32-bit integers as output from a certain function. I'm wanting to hash these four integers, so I can compare the output of this function to future outputs. I'm having trouble writing a decent hashing function though. When I originally wrote this code, I threw in a simple addit...

How do I create a simple integer in Objective-C?

I am trying to create a simple integer variable and can't get it to accept a value. Why does the NSLog print out i=(null)? int i; i = 0; NSLog(@"i=%@", i); How do I create a simple index for an array?.... Thank you... ...