Category: Apps and Tools

Android Adventures-Development Tips-Part 4

How to remove the divider in a ListView?
What if my text doesn’t fit in a TextView?
How to return values from to the caller Activity?
Main Activity:
Highlight an item in a ListView

Android Adventures – Development Tips

How to prevent an EditBox from expanding?

android:layout_width="0dp" – or height, depending the need and the use of the weight

android:layout_weight="1" – if you just have one and you want to fill the whole layout

How to add a Scrollbar to an EditBox?
android:scrollbars=”vertical”
How to write the text on top left of the EditBox?
android:gravity=”top|left”
How to avoid the overlap of the Toolbar with the included layout?
How to Highlight blocks of text in an EditBox?
Spannable spannable=new SpannableString(string);
// You can add other styles here, like bold, underline, other// if you are using a loop, put the Spannable construction outside the loop or sometimes only the last one will be used

spannable.setSpan(new ForegroundColorSpan(Color.BLUE), start, end, 0);
editText.setText(spannable);

Android App – Just Send It 1.0

Screenshot_1545526727

I just developed an Android application to improve your productivity.
Just Send It, an Android application to send a note with the fewer clicks possible.

An application developed to just Write and Send to your preferred email account.

Enjoy it!

Give Me Numbers 1.1

icon_512x512_efeitoBuraco

I released an update to my first Android application developed Give Me Numbers.

User Interface Improved, more colorful
You can choose a separator for the numbers generated

 

Screenshot_1545439156

Jenkins Pipelines and the Blue Ocean plugin

With the big wave of DevOps, Pipelines are one of the most used words. Why? Because continuous integration and continuous delivery are about pipelines.

Jenkins is one of the most used components in a Continuous Integration environment, and its community decided to take into this wave too. How?

Well, redefining how the pipelines are configured and developed in Jenkins.

The new pipelines are developed using Groovy Language, which opens a very wide spectrum of possibilities of configurations to the integration process. (so… who said Groovy lang was dying?)

There are 2 ways of developing pipelines in Jenkins, the Declarative and the Scripted way

In the Scripted approach you use the full power of Groovy language, however, the blue ocean plugin will not be used as expected and you cant visualize the pipeline. More on this later.

node {
    stage('chekout from git') {
        
        checkout([$class: 'GitSCM', 
                branches: [[name: '*/master']], 
                doGenerateSubmoduleConfigurations: false, 
                extensions: [], 
                submoduleCfg: [], 
                userRemoteConfigs: [[]]
        ])
        try {
            sh 'mvn test'
        } catch (e) {
            currentBuild.result = 'FAILURE'
            throw e
        } finally {
            cleanWs cleanWhenFailure: false
        }
    }

    stage('build the project') {
        steps {
            sh 'mvn -B -DskipTests clean package'
        }
    }
}

But it’s the declarative way that draws the pipeline flow as we expected.

This approach brings first an elegant structure of the code and the use of the Blue Ocean plugin where we will visualize the pipeline flow, literally!

An example of a declarative pipeline can be something like this:

pipeline {
    agent none 
    stages {
        stage('chekout from git') {
            steps {
                checkout([$class: 'GitSCM', 
                    branches: [[name: '*/master']], 
                    doGenerateSubmoduleConfigurations: false, 
                    extensions: [], 
                    submoduleCfg: [], 
                    userRemoteConfigs: [[]]
                ])
              }
        }
        stage('build the project') {
            steps {
                sh 'mvn -B -DskipTests clean package'
            }
        }
    }
}

If you install the Blue Ocean plugin and run a declarative pipeline you will see something like this:
(this example was taken from Jenkins website)

Jenkins Pipeline Blue Ocean Plugin

So, should I use Declarative or Scripted Pipelines?
– Scripted Pipelines use the full Groovy language, but you will not have the enhanced visualization.
– Well, declarative is a little more restricted in the structure of the code, but you can always use the step “script { }” to extended the use of Groovy. But you will use the Blue Ocean plugin, something that has its value in a workspace for instance.

The Jenkins website as a good tutorial to follow, please visit it to move forward in this technology.

Hope this post was enough to capture your attention about how Jenkins can have a really beautiful and useful visualization of a pipeline.

Bad Behavior has blocked 141 access attempts in the last 7 days.

Hyper Smash