Author: Luca Zanini
-
Javadoc in Eclipse and Android
In Eclipse launching javadoc from menu (Project -> generate javadoc…) if you get the errors: error: package android… does not exist error: cannot find symbol
-
The Navigator and Dynamic View Panel controls of the Extension Library
In this article I implement the Navigator and Dynamic View Panel controls of the XPages Extension Library in a similar way to the navigator and views in a frameset of a lotus database open using the lotus client.
-
Coin sums
From the Project Euler Problem 31: In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following way: 1×£1 + 1×50p + 2×20p + 1×5p…
-
Digit fifth powers
From the Project Euler Problem 30: Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 14 + 64 + 34 + 44 8208 = 84 + 24 + 04 + 84 9474 = 94 + 44 + 74 + 44 As 1 =…
-
Distinct powers
From the Project Euler Problem 29: Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5: 22=4, 23=8, 24=16, 25=32 32=9, 33=27, 34=81, 35=243 42=16, 43=64, 44=256, 45=1024 52=25, 53=125, 54=625, 55=3125 If they are then placed in numerical order, with any repeats removed, we get the…
-
Preference element in xml and the click event
If you have an EditTextPreference tag in a xml file you can catch the click event implementing OnSharedPreferenceChangeListener but it doesn’t work if you have a Preference tag in the xml file. Consider the following code inside a xml file for the preferences: <Preference android:key=”my_key” android:summary=”my_summary” android:title=”my_title” > </Preference>
-
Number spiral diagonals
From the Project Euler Problem 28: Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 21 22 23 24 25 20 7 8 9 10 19 6 1 2 11 18 5 4 3 12 17 16 15 14 13 It…
-
Quadratic primes
From the Project Euler Problem 27: Euler discovered the remarkable quadratic formula: n² + n + 41 It turns out that the formula will produce 40 primes for the consecutive values n = 0 to 39. However, when n = 40, 40² + 40 + 41 = 40(40 + 1) + 41 is divisible by…
-
Getting the Context inside a Fragment
It is very easy to get the Context inside an Activity: with the getApplicationContext() method using only “this” because the Activity class extends the Context class But you can’t use any of these two methods inside a Fragment and you have to replace them respectively with: getActivity().getApplicationContext() getActivity() I often do this replacement when I…
-
How to set a default method to running code on the creation or destruction of a bean
In the post Executing code on the creation or destruction of a bean in Spring I explain three ways to execute code on the creation or destruction of a Bean in Spring. With two of these ways you can set the execution of a specific custom method: with the annotations @PostConstruct and @PreDestroy configuring the…