Play around with GRAPH API and FQL API
https://www.simoncross.com/fb/graph
Also some useful videos here…
http://developers.facebook.com/videos/
FQL overview here:
Play around with GRAPH API and FQL API
https://www.simoncross.com/fb/graph
Also some useful videos here…
http://developers.facebook.com/videos/
FQL overview here:
Perspectives (top right of screen)
JAVA
DEBUG
DDMS – device info, processes, fake GPS (GPX,KML etc), fake tel info
- file explorer, memory allocation, threads,
logcat (logging output)
_______________________
Window> Andriod SDK AVD manager – setup emulators
_______________________
CTRL+SHIFT+T = open type (eg MyClass)
CTRL + SHIFT + R = open resource (eg main.xml)
CTRL+O – overview of methods in class.. can search with wildcards * too
SHIFT+ALT+R – rename a type and all xrefs to it
CTRL+SHIFT+O = organise the imports (eg add / remove android.os.Bundle)
Also if you add:
Button b;
then hit CTRL+SHIFT+O it’ll add import android.widget.Button;
Ok so here’s the quick how to:
1) Download and install Eclipse from here
http://www.eclipse.org/downloads/
Choose the Eclipse IDE for Java Developers 32 bit version
(64 bit version has issues with Android plugins at time of writing)
Just download.. unzip and put into a new folder on your PC.. say Program Files..
2) Download and install the Java JDK from here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
(again 32 bit option - x86)
Go with default install location is fine here..
3) Install the Android SDK from here:
http://developer.android.com/sdk/index.html
Choose the Windows Installer version as it is a lot easier in this case, as it pulls down various plug in options later in the steps.
If you get an error saying the JDK couldn’t be found then press the BACK button on the install dialogue box.. then push NEXT again.. this time it finds it.. weird install bug.
Change the install path!!! Take out the spaces otherwise you’ll get problems later on.. so make it start with c:\android\
Accept all the options and wait for download/install…
4) Next we need to configure the Eclipse ADT plug in…
Load Eclipse then go to the Help menu.. Choose Install new software
In the Work With box enter>>
https://dl-ssl.google.com/android/eclipse
Give it the Name: Android
Click OK and wait…
(If you have problems check this link which has details on a ZIP download alternative >> http://developer.android.com/sdk/eclipse-adt.html )
Select all, accept licences.. set it going an wait for it to complete.
Restart Eclipse…
Now go to Window > Preference
Choose Andriod > Specify your Android install location (eg C:\Android\AndroidSDK…)
Last one for today… this isn’t fast code but works…
A bit of a speed up implemented by only checking those which are of length equal to their max character… so there’s not point checking 17 as it’s 2 in length.. so max permitted would be 12… however 132 is fine as it’s 3 in length and has a 3 in it!
_______________________
static void Main(string[] args)
{
long max=0;
for (long i = 1; i < 987654321; i++)
{
int len = i.ToString().Length;
//find max char
int maxchar = 0;
foreach (char c in i.ToString())
{
if (c - 48 > maxchar)
{
maxchar = c - 48;
}
}
//only check if this could be pandigital - by checking max char and len
//eg1 17 can't be pandigital as only 2 chars long (eg2 12 =OK, 13=not)
string s = i.ToString();
if (maxchar == len && isprime(i))
{
if (s.Split('1').Length==2 && s.Split('2').Length==2 )
{
if (i.ToString().Length==2 && i > max) {max=i;}
if (s.Split('3').Length==2)
{
if (i.ToString().Length==3 && i > max) {max=i;}
if (s.Split('4').Length==2)
{
if (i.ToString().Length==4 && i > max) {max=i;}
if (s.Split('5').Length==2)
{
if (i.ToString().Length==5 && i > max) {max=i;}
if (s.Split('6').Length==2)
{
if (i.ToString().Length==6 && i > max) {max=i;}
if (s.Split('7').Length==2)
{
if (i.ToString().Length==7 && i > max) {max=i;}
if (s.Split('8').Length == 2)
{
if (i.ToString().Length == 8 && i > max) { max = i; }
if (s.Split('9').Length == 2)
{
if (i.ToString().Length == 9 && i > max) { max = i; }
break;
}
}
}
}
}
}
}
}
}
}
Console.WriteLine(max);
Console.ReadLine();
}
static bool isprime(long n)
{
if (n == 2 || n == 3 || n == 5) { return true; }
if (n%2==0) {return false;}
if (n%3 == 0) { return false;}
if (n%5 == 0) { return false;}
for (int t = 7; t < Math.Sqrt(n); t++)
{
if (n % t== 0)
{
return false;
}
}
return true;
}
Brute force attack!!!
Keep making the string longer until you hit 1 million chars long.. then do the calc they want.. rem first place is s[0]…. and you’re sorted!
____
static void Main(string[] args)
{
string s = "";
int i=0;
while (s.Length<1000001)
{
i++;
s += i.ToString();
}
int sum = (Convert.ToInt32(s[0])-48) * (Convert.ToInt32(s[9])-48) * (Convert.ToInt32(s[99])-48) * (Convert.ToInt32(s[999])-48) * (Convert.ToInt32(s[9999])-48) * (Convert.ToInt32(s[99999])-48) * (Convert.ToInt32(s[999999])-48);
Console.WriteLine("Answer>>"+sum);
Console.ReadLine();
}
An easier one… some geometry and Pythog theroem..
I just made a big array, used that as a counter for each solution.. then scanned it to find the answer.
Just remember that the counter is not for c(the hyp) but for the perimeter length (p=a+b+c)…. !
____________
static void Main(string[] args)
{
int[] cc = new int[1001]; //somewhere to store the counts
for (int a = 1; a < 999; a++)
{
for (int b = 1; b < 999; b++)
{
double c = Math.Sqrt(a * a + b * b);
if (c%1==0 && (a+b+c <= 1000)) //must be int length sides and per<=1000
{
cc[Convert.ToInt32(a+b+c)]++;
}
}
}
//now find largest value
int maxp = 0;
int maxn = 0;
for (int i = 0; i < 1000; i++)
{
if (cc[i] > maxn)
{
maxn = cc[i];
maxp = i;
}
}
Console.WriteLine("Answer>>"+maxp + " count of "+maxn);
Console.ReadLine();
}
So here you need to do some pandigital checks again like problem 32…
We know the answer must be bigger than that given in the example.. as I tried putting their example answer in to see if it was the answer they were after.. but no…! Anyway this means the final value is somewhere between 91873654 and 987654321… so that’s a start.
I was thinking the number of parts to split up the 9 digit number into may be 2,3,4.. as in 123,456789 would be 2 parts.. but to be a correct value then part 1 x 2 should equal part 2… (not here obviously as 123 * 2 = 246)…
My plan was to try this with 2 parts.. and if it didn’t work then look at 3 parts.. and so on.. but I ran it with 2 parts and got the answer so didn’t need to go any further than this!!
Not the smartest, or most elegant solution… but it did the job..
____________________
static void Main(string[] args)
{
//must be bigger than 918273654 as it's mentioned in question
//and I tested it as the answer and it wasn't..
for (int i = 987654321; i > 918273645; i--)
{
string s = i.ToString();
//contains 1-9 once - pandigital 9
if (
s.Split('1').Length == 2 &&
s.Split('2').Length == 2 &&
s.Split('3').Length == 2 &&
s.Split('4').Length == 2 &&
s.Split('5').Length == 2 &&
s.Split('6').Length == 2 &&
s.Split('7').Length == 2 &&
s.Split('8').Length == 2 &&
s.Split('9').Length == 2)
{
//check case of 2 parts
for (int n=1;n<9;n++)
{
int part1 = Convert.ToInt32(i.ToString().Substring(0,n));
int part2= Convert.ToInt32(i.ToString().Substring(n,i.ToString().Length-n));
if (part2==part1*2)
{
Console.WriteLine(i);
goto foo;
}
}
}//end of pandigital check
}
foo:
Console.WriteLine("Done!");
Console.ReadLine();
}