int

Method return type

Hi, In my company, a system is designed to have 3 layers. Layer1 is responsible for business logic handling. Layer3 is calling back end systems. Layer2 sits between the two layers so that layer1 doesn't need to know about the back end systems. To relay information from layer3, layer2 needs to define interface to layer1. For example, la...

TextAlignment="Right" has no effect in WPF XAML bound to int field?

The binding works great, but as soon as I bind to to an field of type int, the field no longer gets alignet to the right? <TextBlock TextAlignment="Right" Width="50" Text="{Binding SomeIntField}"> </TextBlock> ...

mysql data type confusion

So this is more of a generalized question about MySQLs data types. I'd like to store a 5-digit US zip code (zip_code) properly in this example. A county has 10 different cities and 5 different zip codes. city | zip code -------+---------- city 0 | 33333 city 1 | 11111 city 2 | 22222 city 3 | 33333 city 4 | 44444 city 5 | 55555 city...

Is there a way in .Net to get a string value for an int's word?

For example: (1).SomeFunction().Equals("one") (2).SomeFunction().Equals("two") I really only need it for digits 1-9 in the case I'm working with, should I just use a switch/select case? Update I won't need localization in this case either. Update 2 Here's what I ended up using: Private Enum EnglishDigit As Integer zero one ...

What is size_t in C?

Hi, I am getting confused with size_t in C. I know that it is returned by the sizeof operator. But what exactly it is? Is it a datatype? Let's say I have a for loop int i; or size_t i; //which one should i use? for(i = 0; i < some_size; i++) ...

Cocoa:NSUInteger vs unsigned int When the Range is Very Small?

I have an unsigned int variable and it can only have the values of 0 -> 30. What should I use: unsigned int or NSUInteger? (for both 32 and 64 bit) ...

How do I convert a single char in string to an int

Keep in mind, if you choose to answer the question, I am a beginner in the field of programming and may need a bit more explanation than others as to how the solutions work. Thank you for your help. My problem is that I am trying to do computations with parts of a string (consisting only of numbers), but I do not know how to convert a...

Making your own "int" or "string" class

I disassembled the .NET 'System' DLL and looked at the source code for the variable classes (string, int, byte, etc.) to see if I could figure out how to make a class that could take on a value. I noticed that the "Int32" class inherits the following: IComparable, IFormattable, IConvertible, IComparable, IEquatable. The String and Int32...

How do I format Int32 numbers?

What is the best way to get formatted Int32 numbers? Let say I have this o function: string o(int x); This is the value that o need to return according to x x = 0 => o = 00 x = 1 => o = 01 x = 5 => o = 05 x = 10 => o = 10 x = 31 => o = 31 x = 106 => o = 106 ...

iPhone Problem comparing course value for cllocation

hi all, i'm writing some code for getting some values including course -(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //somecode NSString *dirString = [[NSString alloc] initWithFormat:@"%d", newLocation.course]; int myInt = [...

Get PocketC File Handle Int?

I'm now taking a look at the PocketC powerful tool, but there is an fileopen function, that generates a integer called filehandle, that is used for most of the File I/O operations of PocketC. How do I use this int filehandle to call the other file manipulation functions? Here is my example function that I'm using at my program: fileope...

Django IN query as a string result - invalid literal for int() with base 10

Trying to query a 'Favorites' model to get a list of items a user has favorited, and then querying against a different model to get the objects back from that query to present to the template, but I'm getting an error: "invalid literal for int() with base 10" Looking over all of the other instances of that error, I couldn't find any in ...

Rounding a double to turn it into an int (java)

Right now i'm trying this: int a = round(n) ; where n is a double but its not working. What am i doing wrong? ...

Java - How to avoid loss of precision during divide and cast to int?

I have a situation where I need to find out how many times an int goes into a decimal, but in certain cases, I'm losing precision. Here is the method: public int test(double decimalAmount, int divisor) { return (int) (decimalAmount/ (1d / divisor)); } The problem with this is if I pass in 1.2 as the decimal amount and 5 as the divi...

How to get the most common value in an Int array? (C#)

How to get the most common value in an Int array using C# eg: Array has the following values: 1, 1, 1, 2 Ans should be 1 ...

inheritance from str or int

Why I have problem creating a class the inherite from str (or also int) class C(str): def __init__(self, a, b): str.__init__(self,a) self.b = b C("a", "B") TypeError: str() takes at most 1 argument (2 given) tha same happens if I try to use int instead of str, but it works with custom classes. I need to use __new__ inst...

Parse int to string with stringstream

Well! I feel really stupid for this question, and I wholly don't mind if I get downvoted for this, but I guess I wouldn't be posting this if I had not at least made an earnest attempt at looking for the solution. I'm currently working on Euler Problem 4, finding the largest palindromic number of two three-digit numbers [100..999]. As...

Converting integer to a bit representation

How can I convert a integer to its bit representation. I want to take an integer and return a vector that has contains 1's and 0's of the integer's bit representation. I'm having a heck of a time trying to do this myself so I thought I would ask to see if there was a built in library function that could help. Thanks! Edit: Excellent i...

Convert int to datetime

how can i convert a field contain data 733803 as into be datetime on sql server? ...

How do you convert an int to a byte in Objective-C?

Hello, I have an int value which needs to be converted into a byte array. How do you go about doing this in Objective-C? Are there methods to do this? Thank you, ...