Is there a function that takes 1,2,3 and returns 3,1,2 respectively and vice-verse.
eg: f(1)=3
f(2)=1
f(3)=2
This is required to get the cyclic order eg 1 when gone left will be 3 , 2 will be 1 and 3 will be 2.
1 when gone right will be 2 , 2 will be 3 and 3 will be 1.
...
Hi!
I am writing an application using Objective C and I want to access the iPhone favorites numbers (the ones that can be found in the "Phone" application). I've searched among the properties specific to each contact from the Address Book and I even had a look at the Address Book database, but I couldn't identify which property or field...
Ok right , i asked how to create a random number from 1-100 for android and i came to this
TextView tv = new TextView(this);
int random = (int)Math.ceil(Math.random()*101);
tv.setText("Your Number Is..."+ random );
What this does is create the default kinda "hello world" style text view and says "Your Number Is.... [Th...
Hi all.
I'm using SL 4 beta and my app needs to do a lot of small http requests to the server.
I believe that when exceeding the number of allowed concurrent requests, the subsequent requests are put in a queue.
I am also aware that SL 4 has both a http browser stack and a http client stack, with both different limit in terms of the num...
There is a similar question on SO which suggests using NumberFormat which is what I have done.
I am using the parse() method of NumberFormat.
public static void main(String[] args) throws ParseException{
DecToTime dtt = new DecToTime();
dtt.decToTime("1.930000000000E+02");
}
public void decToTime(String angle) throws ParseE...
Hi!
I've got a huge problem. I made a special ID for the things in our webpage. Let's see an example:
H0059 - this is the special ID called registration number. The last two chars are the things' id.
I'd like to cut off the useless characters, to get the real ID, what means strip the first char, and all the 0s before any other number...
I have variables with values like 1.7m 1.8k and 1.2b how can I convert them to a real number value for example
1.7m = 1700000
1.8k = 1800
1.2b = 1200000000
...
I need some help revising this. It keeps only displaying 0s as the temp. Thank you.
// A program to determine whether the input number is a perfect number
// A perfect number is defined by the sum of all its positive divisors excluding itself
// 28: 1+2+3+7+14 = 28.
int perfect, limit, divisor;
cout << "Please enter a positive intege...
hello everyone. Thank you for your help in advance. I am a student in a concepts of programming class. The lab is run by a TA and today in lab he gave us a real simple little program to build. It was one where it would multiply by addition. Anyway, he had us use absolute to avoid breaking the prog with negatives. I whipped it up real qui...
I'm looking for a way to format numbers using "tokens". This needs to be conditional (for the first few leading characters).
Example:
<?php
$styles=array('04## ### ###','0# #### ####','13# ###','1800 ### ###');
format_number(0412345678); /*should return '0412 345 678'*/
format_number(0812345678); /*should return '08 1234 5678'*/
fo...
Can anyboyd help me split up this date number in javascript so that when it is outputted to the screen it has slashes between the 4th and 5th number and the 6th and 7th number, so that it can be understood by a vxml voice browser. The number can be any value so i need it to work for any eight digit number.
Like so:
20100820
2010/08/20...
Ever since I started programming this has been something I have been curious about. But seems too complicated for me to even attempt.
I'd love to see a solution.
1, 2, 3, 4, 5 // returns 6 (n + 1)
10, 20, 30, 40, 50 //returns 60 (n + 10)
10, 17, 31, 59, 115 //returns 227 ((n * 2) - 3)
...
What would be equivalent of Number(4) of Oracle database to MySQL Datatype ?
...
What's the simplest way of changing a negative number to positive with ruby?
ie. Change "-300" to "300"
...
I am given a number N, and i must add some numbers from the array V so that they wil be equal. V is consisting of numbers that are all powers of 3:
N = 17
S = 0
V = 1 3 9 27 81 ..
I should add numbers from V to N and S in order to make them equal. The solution to the example above is :
17 + 1 + 9 = 27, 27, 1 and 9 are taken fr...
can someone help with this?
I need the following function to do this...
$x = 'AAAABAA';
$x2 = 'ABBBAA';
function foo($str){
//do something here....
return $str;
}
$x3 = foo($x); //output: A4B1A2
$x4 = foo($x2);//output: A1B3A2
...
I want to check if a floating point value is "nearly" a multiple of 32. E.g. 64.1 is "nearly" divisible by 32, and so is 63.9.
Right now I'm doing this:
#define NEARLY_DIVISIBLE 0.1f
float offset = fmodf( val, 32.0f ) ;
if( offset < NEARLY_DIVISIBLE )
{
// its near from above
}
// if it was 63.9, then the remainder would be large,...
I know I can use the RODBC library for accessing excel (.xls) docs from within Windows, but is there something similar for the Numbers program that come with iWorks? If not, what other solutions are there for easily editing a spreadsheet (like a lookup table) and accessing it within R? I know there the is an internal R editor, but I d...
I suppose the real question is how to convert base2/binary to base10. The most common application of this would probably be in creating strings for output: turning a chunk of binary numerical data into an array of characters. How exactly is this done?
my guess:
Seeing as there probably isn't a string predefined for each numerical value...
How to generate random number from an array? and not from a range.
int n [] = {1,7,3,5,8,10,33,12,18}
...