Category Archives: Software Development

Importance of Android source code obfuscation

Obfuscation is a method applied to transform a message into a difficult to read message. Android source code obfuscation is applied to make it difficult the reverse engineering of some application code.

However, it is important to mention that it is a method which is not a complete protection and it is just a way of discouraging others from accessing the code.

Proguard is the obfuscation tool used in Android projects and it is supported by Android Studio and Eclipse using the Android SDK. Besides obfuscating the code, it removes unused or unreachable code, sorts and optimizes the application bytecode and simplifies the logical and arithmetic operations. There are many restrictions in the mobile software development environment. Restricted access to the Internet and limited power availability are just two of them. Thus, using a tool like Proguard is interesting to improve the quality of your software and consequentially the user experience.

In order to illustrate the application of Proguard tool with obfuscation enabled, we created a Java class named Sample which contains a method implementing the factorial function and some other controlling code. Obfuscation changes the names of the class, methods, and variables to random symbols which makes much more difficult to understand the code. Unused code (unusedMethod) and the unreacheable code (debug ‘if’ clause) are removed by Proguard in order to optimize the final code used by the software application.

When publishing your application on the Play Store remember that developers are required to obfuscate the application code. Recently, the Android developer console started to offer developers the possibility to associate the generated obfuscation map to each of the published versions of the application. Using this feature, developers are able to visualize the non-obfuscated stack trace of an error right through the console and identify the source of the problem.

Android and Java projects developed by Endeeper are always obfuscated in order to keep the quality of our products. Contact us if you have any comments or questions.

public class Sample {
    private static final boolean DEBUG_ON = false;
    public int factorial(int number) {
 
        if (DEBUG_ON) {
            System.out.println("This will be removed");
        }
        if (number == 0) {
            return 1;
        } else {
            return number * factorial(number - 1);
        }
    }
 
    private void unusedMethod() {
        // This method will be removed
    }
}
public class A {
  public int b(int a) {
    if (a==0) {
      return 1;
    }
    return a*b(a-1);
  }
}

References

Benefits of CSS Styling in JavaFX Projects

One of the great features brought by JavaFX is the support to Cascading Style Sheets (CSS) to style the application and its graphic components.

The JavaFX supports version 2.1 of the CSS specification and adds a few own extensions with the prefix -fx. In web pages the CSS interacts with the Document Object Model (DOM) of HTML and allows the style applied in a parent element to be available to all children elements. In this way, if a font size of 14 points is applied in a parent list element all list-items elements will have a font size of 14 points. The CSS behavior in JavaFX is very similar but using the Node hierarchy. If a style is defined in a parent Node all children Node will have the same style.

The CSS code responsible for styling a graphic component is saved in a style file (with .css suffix) detached from the code responsible for component structure. Therefore, the Java classes will be smaller and simpler, and the style changing will be directly in the style file. To exemplify the benefits of CSS styling in JavaFX graphic components we will build and style a simple component using Java and CSS code.

Our component has two vertically stacked buttons and we want both to have the same style. In the first case we only use Java code to define the style of the buttons. In the second case we create a CSS class and apply it to both buttons.

The visual result of both codes is the same, but the difference in size and complexity of the code is huge. Thereby, the systems developed by Endeeper with JavaFX technology use CSS to style the graphic components. A single Endeeper software may have different visual according to the individual requirements of each client.

Button button = new Button("Geology Rocks!");
button.setBackground(new Background(new BackgroundFill(Color.web("CC7722"), new CornerRadii(127), Insets.EMPTY)));
button.setBorder(new Border(new BorderStroke(Color.TRANSPARENT, BorderStrokeStyle.NONE, new CornerRadii(127), BorderWidths.EMPTY)));
button.setEffect(new InnerShadow(BlurType.THREE_PASS_BOX, Color.web("27496d"), 2, 0, 0, 0));
button.setFont(Font.font("Trebuchet MS", 18.0));
button.setTextFill(Color.WHITE);
 
Button button2 = new Button("Geology Rocks even more!");
button2.setBackground(new Background(new BackgroundFill(Color.web("CC7722"), new CornerRadii(127), Insets.EMPTY)));
button2.setBorder(new Border(new BorderStroke(Color.TRANSPARENT, BorderStrokeStyle.NONE, new CornerRadii(127), BorderWidths.EMPTY)));
button2.setEffect(new InnerShadow(BlurType.THREE_PASS_BOX, Color.web("27496d"), 2, 0, 0, 0));
button2.setFont(Font.font("Trebuchet MS", 18.0));
button2.setTextFill(Color.WHITE);
Button button1 = new Button("Geology Rocks!");
button1.getStyleClass().add("geology-btn");
Button button2 = new Button("Geology Rocks even more!");
button2.getStyleClass().add("geology-btn");
.geology-btn {
    -fx-font: 18px "Trebuchet MS";
    -fx-text-fill: white;
    -fx-background-color: #CC7722;
    -fx-effect: innershadow( three-pass-box , #27496d , 2, 0, 0, 0);
    -fx-border-radius: 15px;
    -fx-background-radius: 15px;
}
JavaFX with CSS

 

References

Tools for RESQML data management

RESQML™, according to Energistics, is an industry initiative to provide open, non-proprietary data exchange standards for reservoir characterization, earth and reservoir models.

We have recently released an article that describes the public domain tools that the RESQML community is offering for allowing developers and end users to validate RESQML EPC instances written and read by RESQML users: software vendors (Paradigm, Schlumberger, and others), petroleum companies (Total, Shell, Chevron) owning proprietary products or international research centres.

Endeeper team can help oil and gas companies to evaluate the adoption of RESQML standard.

Click here to get more information about the RESQML tools article.