Luca Zanini
  • Home
    • Astronomy
    • Android
    • Java
    • Lotus
  • About me
  • Preference element in xml and the click event

    Oct 14, 2013

    —

    by

    Luca Zanini
    in Uncategorized

    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>

    Read more: Preference element in xml and the click event

  • Number spiral diagonals

    Oct 13, 2013

    —

    by

    Luca Zanini
    in Uncategorized

    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…

    Read more: Number spiral diagonals

  • Quadratic primes

    Oct 5, 2013

    —

    by

    Luca Zanini
    in Uncategorized

    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…

    Read more: Quadratic primes

  • Getting the Context inside a Fragment

    Oct 1, 2013

    —

    by

    Luca Zanini
    in Android

    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…

    Read more: Getting the Context inside a Fragment

  • How to set a default method to running code on the creation or destruction of a bean

    Sep 28, 2013

    —

    by

    Luca Zanini
    in Java

    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…

    Read more: How to set a default method to running code on the creation or destruction of a bean

  • Reciprocal cycles

    Sep 25, 2013

    —

    by

    Luca Zanini
    in Uncategorized

    From the Project Euler Problem 26: A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: 1/2 = 0.5 1/3 = 0.(3) 1/4 = 0.25 1/5 = 0.2 1/6 = 0.1(6) 1/7 = 0.(142857) 1/8 = 0.125 1/9 = 0.(1) 1/10 = 0.1…

    Read more: Reciprocal cycles

  • 1000-digit Fibonacci number

    Sep 15, 2013

    —

    by

    Luca Zanini
    in Uncategorized

    From the Project Euler Problem 25: The Fibonacci sequence is defined by the recurrence relation: Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. Hence the first 12 terms will be: F1 = 1 F2 = 1 F3 = 2 F4 = 3 F5 = 5 F6 = 8 F7 =…

    Read more: 1000-digit Fibonacci number

  • # vs $ in the computed expressions in the xpages

    Sep 13, 2013

    —

    by

    Luca Zanini
    in Lotus

    In the xml code of the xpages the computed expressions begin with the character “#” or with the character “$”, ie they are one of the following types: value=”#{[language]:[expression]}” value=”${[language]:[expression]}” where [language] is the name of the language, for example javascript and [expression] is the expression to compute. The question is “what is the difference…

    Read more: # vs $ in the computed expressions in the xpages

  • How to access to a control connected to a lotus field using javascript

    Sep 6, 2013

    —

    by

    Luca Zanini
    in Lotus

    In this post I test how to access via javascript to the following controls connected to a lotus field: Edit Box: a control for entering a single line of data Hidden Input: a control for hiding data to the user A Hidden Input control is not such as an Edit Box control with “Visible” unchecked…

    Read more: How to access to a control connected to a lotus field using javascript

  • Lexicographic permutations

    Sep 5, 2013

    —

    by

    Luca Zanini
    in Uncategorized

    From the Project Euler Problem 24: A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: 012 021…

    Read more: Lexicographic permutations

←Previous Page Next Page→