Loading
24, Jul 2023
Concatenating strings vs. StringBuilder 2 – Text blocks, Locales, Numbers & Math

JDK 11 JDK 11 produces the following bytecode for concatViaPlus(): Figure 1.13 – JDK 11 bytecode of concatViaPlus() We immediately observe a big difference here. This time, the concatenation is accomplished via a call to invokedynamic (this is a dynamic call) which acts as a delegator for our code. Here,…

20, Jul 2023
Concatenating strings vs. StringBuilder – Text blocks, Locales, Numbers & Math

12. Concatenating strings vs. StringBuilder Check out the following plain string concatenation: String str1 = “I love”;String str2 = “Java”;String str12 = str1 + ” ” + str2; We know that the String class is immutable (a created String cannot be modified). This means that creating str12 requires an intermediary…

24, Mar 2023
Converting int to String – Text blocks, Locales, Numbers & Math

13. Converting int to String As usual, in Java, we can accomplish a task in multiple ways. For instance, we can convert an int (primitive integer) to String via Integer.toString() method as follows: public String intToStringV1(int v) {  return Integer.toString(v);} Or, via a quite common hack (the code reviewer will…

24, Jan 2023
Creating a Locale – Text blocks, Locales, Numbers & Math

14. Creating a Locale A Java Locale (java.util.Locale) represents an object that wraps information about a specific geographical, political, or cultural region, so an object useful for internationalization purposes. A Locale is typically used in conjunction with DateFormat/DateTimeFormatter to represent date-time in the format specific to a country, with NumberFormat…

24, Nov 2022
Customizing localized date-time formats – Text blocks, Locales, Numbers & Math

15. Customizing localized date-time formats Starting with JDK 8, we have a comprehensive date-time API containing classes such as LocalDate, LocalTime, LocalDateTime, ZonedDateTime, OffsetDateTime, and OffsetTime. We can easily format the date-time output returned by these classes via DateTimeFormatter.ofPattern(). For instance, here we format a LocalDateTime via the y-MM-dd HH:mm:ss…

24, Sep 2022
Restoring Always-Strict Floating-Point semantics 2 – Text blocks, Locales, Numbers & Math

The strictfp modifier can be used for classes (and is applied to nested classes as well), non-abstract methods, and interfaces. It cannot be used for variables, constructors, or abstract methods. When the strictfp modifier is used on an interface there are some headlines to point out as follows: It is…

15, Sep 2022
Restoring Always-Strict Floating-Point semantics – Text blocks, Locales, Numbers & Math

16. Restoring Always-Strict Floating-Point semantics Floating-point calculations are not easy! Even some simple arithmetical properties don’t apply to such calculations. For instance, floating-point addition or multiplication is not associative. In other words (x + y) + z is not equal to x + (y + z) where x, y, and…

24, Jul 2022
Configuring EM Agents – Introduction to Oracle Sharding

Configuring EM Agents The lab environment, where agents will be deployed and sharding components will be discovered, is as follows: •\    oem13c: Oracle Enterprise Manager Cloud Control (OEMCC) 13c server •\    gsmcat: Shard catalog database (gsmcatdb) and shard director •\    prsh01: Primary shard database server •\    prsh02: Primary shard database…

20, May 2022
Configuring Autodiscovery – Introduction to Oracle Sharding

Configuring Autodiscovery To add the shard catalog database, primary shards, and standby shards, you need to use a smart feature of the EM, dubbed target autodiscovery. Select Setup ➤ Add Target ➤ Configure Auto Discovery, and then click the Advanced: Discovery Modules tab. Choose Oracle Database, Listener, and Automatic Storage…

20, Mar 2022
Reviewing Sections Related to Sharding – Introduction to Oracle Sharding

Reviewing Sections Related to Sharding When sharding targets are added to EM, the following sections will contain links to specific objects. To view sharding architecture–related sections, from the EM console, click Targets and then All Targets. You’ll see Shard Director, Sharded Database, Shardgroup, and Shardspace sections (Figure 3-8). Figure 3-8. …