integer

Should I use a big INT or regular INT in MySQL to store a timestamp?

Should I be using a big integer or a regular integer in MySQL to store a timerstamp in? I plan on storing it in an INT and not the built in timestamp or datetime so which INT type should I use? ...

Java parameter passing question

Hey everyone, I am relatively new to Java and while trying out some code came across something that surprised me. Hopefully some one can shed some light on this. Here's some code snippets relevant to my question. Those who've read the practice of programming might find this familiar. This function is defined for the List datatype, and...

How do I query on a number in Zend Lucene?

How can I create a Query to search for a number? $query->addTerm(new Zend_Search_Lucene_Index_Term('1', 'id'), null); $query->addTerm(new Zend_Search_Lucene_Index_Term('frank', 'name'), null); $queryP = Zend_Search_Lucene_Search_QueryParser::parse($query); $hits = $ix->find($queryP); echo $queryP; Returns; ...

Find sequences of digits in long integers efficiently

Is it possible to find a defined sequence in an integer without converting it to a string? That is, is it possible to do some form of pattern matching directly on integers. I have not thought of one but I keeping thinking there should be a mathematical way of doing this. That's not to say it is more efficient. (edit) I actually what num...

Octave inverse matrix and integer result

Hi, I would like to get an invertible matrix in Octave but as integers matrix, so: x = [9,15;19,2]; inv(x) and the result is: [-0.0074906, 0.0561798; 0.0711610, -0.0337079] but I would like to get [22,17;25,21] anyone knows how to convert this result? Many thanks. ...

How to disable commas on Integer field in Edit item screen

Hi, I have a field defined as this: <Field Type="Integer" DisplayName="BŠS" Required="FALSE" Commas="FALSE" Group="CRPU grupa" ID="{f8ae007e-df89-4149-8318-a79673cec338}" SourceID="{e0015c45-f539-484b-ae04-b792801053e3}" StaticName="BŠS" Name="BŠS" /> This is a part of a custom content type, which is added to a list. When I display ...

Calculating large factorials in C++

Hi all, I understand this is a classic programming problem and therefore I want to be clear I'm not looking for code as a solution, but would appreciate a push in the right direction. I'm learning C++ and as part of the learning process I'm attempting some programming problems. I'm attempting to write a program which deals with numbers...

how can I generate integers that satisfy some restrictions?

Can anyone give me a hand with techniques to generate integers that satisfy certain restrictions. For example, say I need to generate integers x and y such that 100 > x and y < x + 5 And I don't mean this particular example but some generic techniques to generate integers that satisfy certain conditions. Thanks a lot! Manue...

Handling numbers with leading zeros in Tcl

I am having trouble in Tcl using numbers with leading zeros. I am parsing some numbers that can have leading zeros, such as "0012", which should be interpreted as the integer "twelve". $ tclsh % set a 8 8 % set b 08 08 % expr $a - 1 7 % expr $b - 1 expected integer but got "08" (looks like invalid octal number) What is the best way ...

Converting a number (1, 2, 3) to a string (one, two, three) in PHP

Does anyone know how to convert a number such as 1, 2, or 3 to their text version (one, two, three) in PHP? I only need to convert from 1 to 99. I know I could write a huge switch statement but that would be ridiculous. ...

Convert Linux C Char Array to Int

Hi Guys, need some advice on this one as im struggling abit and cannot figure it out. i have a file that gets updated on a PC to indicate a system ran and what time it ran. i am writing a very simple linux console app (will eventually be a nagios plugin). that reads this file and responds depending on what it found within the file. i a...

Java: Is it ok to set Integer = null ?

I have a function that returns an id number if the argument exists in the database. If not, it returns null. Is this begging for a null pointer exception? Negative id numbers are not permitted, but I thought it would be clearer to have non-existent arguments returning null instead of an error code like -1. What do you think? private Int...

ANSI C, integer to string without variadic functions

I'm currently working with a SPC that supports ANSI C, but uses its own flavour of the GNU compiler, which doesn't compile any variadic functions and things like itoa. So using sprintf & co. isn't an option for converting integers to strings. Can anyone guide me to a site where a robust, sprintf- free implementation of itoa is listed or ...

Why can't I inherit from int in C++ ?

I'd love to be able to do this: class myInt : public int { }; Why can't I ? Why would I want to? Stronger typing. For example, I could define two classes intA and intB, which let me do intA+intA or intB+intB, but not intA+intB. "Ints aren't classes" so? "Ints don't have any member data" Yes they do, they have 32 bits, or whatever....

Leading and Trailing '0' gives error

random.randint(50,9) or random.randint(5,09) give errors, although just random.randint(5,9) ..works! Leading and trailing zero's aren't allowed in python without converting it to string or using x.f formatting? ...

Why is atoi returning random numbers?

I am trying to read in data from a text file (the time). and convert that into something that can be DiffTime'ed to the current system time. I am now so close to getting this working correctly, I can taste it but I am stuck with an issue I cannot work out. (I have a very basic grasp of the C language). this program reads in the data fr...

Convert a string into an integer - each representation

Is there a function or library that can convert any (default, octal, hex, ...) integer in C given as a char[] into an unsigned long long int ? Examples: 1 1l 1ul 42e+10 0x2aLL 01234u ... atoi has some problems with 0x... and the suffixes u/l. ...

Most compact way to encode a sequence of random variable length binary codes?

Let's say you have a List<List<Boolean>> and you want to encode that into binary form in the most compact way possible. I don't care about read or write performance. I just want to use the minimal amount of space. Also, the example is in Java, but we are not limited to the Java system. The length of each "List" is unbounded. Therefo...

objective c iphone integers

Is it true to say that when using integers when programming for iphone that you do not synthesize them and that you do not release them. If it is true could somebody explain why? I get errors everytime that I try to. Also if I set an @property for an integer value I too get errors ...

Java integer to byte array

I got an integer: 1695609641 when I use method: String hex = Integer.toHexString(1695609641); system.out.println(hex); gives: 6510f329 but I want a byte array: byte[] bytearray = new byte[] { (byte) 0x65, (byte)0x10, (byte)0xf3, (byte)0x29}; how can i make this?? :D thnx! ...