Author: Luca Zanini

  • Digit canceling fractions

    From the Project Euler Problem 33: The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8, which is correct, is obtained by cancelling the 9s. We shall consider fractions like, 30/50 = 3/5, to be trivial examples. There are exactly four non-trivial…

  • The services in Android

    A service is a task running in the background to perform actions without a user interface and they are used to perform long running operations with a significant use of resources by avoiding delays in the user experience. The services belong to one or both of the following categories: started: the service is launched using…

  • Passing an object from an Activity to another

    The method startActivity(Intent intent) of the class Activity allows you to call a second activity specified using the argument Intent. You can associate primitive data or primitive data array to the argument Intent and then the second Activity can access them, you can also pass objects of type String using methods of the class Bundle…

  • Pandigital products

    From the Project Euler Problem 32: We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital. The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing multiplicand, multiplier,…

  • 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>