-
Quadratic primes
Read more: Quadratic primesFrom 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
Read more: Getting the Context inside a FragmentIt 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
Read more: How to set a default method to running code on the creation or destruction of a beanIn 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…
-
Reciprocal cycles
Read more: Reciprocal cyclesFrom 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…
-
1000-digit Fibonacci number
Read more: 1000-digit Fibonacci numberFrom 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 =…
-
# vs $ in the computed expressions in the xpages
Read more: # vs $ in the computed expressions in the xpagesIn 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…
-
How to access to a control connected to a lotus field using javascript
Read more: How to access to a control connected to a lotus field using javascriptIn 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…
-
Lexicographic permutations
Read more: Lexicographic permutationsFrom 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…
-
The Form Layout Column control of the Extension Library
Read more: The Form Layout Column control of the Extension LibraryThe Form Layout Column control allow you to place the various controls (such as Form Layout Row) on multiple columns. In the post The Form Table and Form Layout Row controls of the Extension Library I built a xpage with two Form Layout Row controls at different lines, using two Column Layout Form controls you…