Tip Linux tools

All

A simple trick on the directory you’re.

To open the file manager you can do nautilus .  OR xdg-open OR gnome-open

 

Jboss

All

Intro

I also do some stuff in Java, and it’s quite powerful and reliable still. Take Jboss for example, deployment is very straightforward and everything pretty much automatic, like deploying in Django/Flask, which I already told about it.

Jboss Deployment

After installation, the deployment is done just by copying the .war file to the standalone application directory. The run the standalone application just run the batch /bin/standalone.sh nothing more.

Jboss logs

One very important thing about JBoss is the console messages that appear on the log message since they are pretty human readable and therefore give the complete path of what is happening beneath the application. The logs below describe the deployment, undeployment of a standalone applicatin called example.war.

16:12:11,764 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of “example.war” (runtime-name: “example.war”)
16:12:12,098 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-4) ISPN000128: Infinispan version: Infinispan ‘Chakra’ 8.2.8.Final-redhat-1
16:12:12,349 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool — 62) WFLYCLINF0002: Started client-mappings cache from ejb container
16:12:12,458 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool — 67) WFLYUT0021: Registered web context: ‘/example’ for server ‘default-server’
16:12:12,503 INFO [org.jboss.as.server] (DeploymentScanner-threads – 1) WFLYSRV0010: Deployed “example.war” (runtime-name : “example.war”)
16:58:49,448 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool — 67) WFLYUT0022: Unregistered web context: ‘/example’ from server ‘default-server’
16:58:49,466 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0028: Stopped deployment example.war (runtime-name: example.war) in 23ms
16:58:49,481 INFO [org.jboss.as.repository] (DeploymentScanner-threads – 1) WFLYDR0002: Content removed from location /home/fdemeloj/EAP-7.1.0/standalone/data/content/cb/e0a3a1e144bf6d37dba6cba8ccbc46000fef39/content
16:58:49,482 INFO [org.jboss.as.server] (DeploymentScanner-threads – 1) WFLYSRV0009: Undeployed “example.war” (runtime-name: “example.war”)

REFs

[1] https://www.youtube.com/watch?v=jP0g6vLeMDQ

 

Java Garbage collector strategies

All

Intro

I was reading recently about Gargabe collection in Java and I came to find Plumbr company their blogs about this theme. I came to this book [1]. The info I summarized below is basically from that source and others [2][3]. This is the first article about this topic and introduces the main concepts.

Garbage Collector – GC

Very well known, the garbage collector is the automated tool used for reclamation of unused memory eliminating. Such automation is called Garbage Collection. 

The so well debated Garbage Collector is one of those things that make Java such a special language actually.

Fragmenting and Compacting

If we eliminate the objects, considering that they are randomly distributed, the after fragmenting, it’s also an interesting thing to compact the memory. This process actually takes time and requires

Young and Tenured (Old)

The distribution of objects is done according to the time of creation/assignment time and by classifying those objects we pretty much get a complete and accurate picture about the objects, in a screenshot.

Stop The World pause

Basically is when the application is temporarily paused so the GC can do its complete work and clean the objects, but since they keep changing, we need to pause the application and take a screenshot of the application so the GC can delete real objects.

GC Algorithms

There are many algorithms that can be used in the GC that take different approaches for young and tenured objects, in other words, we can delete those objects using different ways.

REFs

[1]https://downloads.plumbr.io/Plumbr%20Handbook%20Java%20Garbage%20Collection.pdf

 

 

Scrum Evalution Form

All

Intro

Together with Gabriel A., we are working in a Scrum Evaluation paper and therefore we would like to take your time, about 5 min, to evaluate some practices in Scrum methodology.

It’s a very simple Google form and we will use the information wisely. If possible we would like to ask for some comments too, if it’s not much to ask actually.

Obv// please speak the truth, not what your boss would like to hear – two different things sometimes.

Form

 

Repl.it

All

Intro

I usually use Repl.it for quick prototyping some stuff, it’s very clean and although I couldn’t find any other mention of this online framework, ie. Online IDE, I think it’s quite interesting and I talked several times about it here.

Those are some interesting features that I’d like to highlight:

Repl.it

It’s an online IDE for development in several languages

Learn and teach

There are courses with assignments and all. Quite cool, I’m doing a course there.

Multiple languages

Well, the possibility to use several languages, including python2.7 and python3 is quite interesting.

Conversations

Not that much used, the possibility to post some questions online is very interesting. Although most often the questions that arrive while developing are googleable, once in a while there are more architecture questions.

Multiplayer

I think it’s one of the most powerful features of Repl.it and allows someone to code with someone else.  I recently started to develop a project with a colleague and it was quite intersting.

REFs

[1] https://repl.it/repls

Flask Framework

All

Intro

I’m a Django guy, well, at least a bit. More python than Django, as some people say. But recently I started to play with Flask[1], quite simple and very appropriate for building small reliable api’s.

Flask

Several tutorials online can be found, the one I really like is this [2], Miguel Grinberg is quite didatict and explains the practical part very well.

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

Example

I did an small example with Flask and Google API connection and it’s on my git.

 

Tips

1. For releasing the API not in localhost, please change the last line:

app.run(debug) --> app.run(host='0.0.0.0')

2. Use POSTMAN to do the tests and export the tests as collections

3. You can use a AWS or Google Cloud/Azure for the tests. Google is pretty nice actually, AWS too.

4. Be patience cause it might happen a little delay on the deployment in the instances.

REFs

[1] http://flask.pocoo.org

[2] https://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask

[3] https://github.com/FranciscoMeloJr/Python-Tests

 

Debugging by Hypothesis

All

Intro

When bugs arrive there are many things that might have cause them, and actually we spend more time trying to find the bugs than coding [1].

If we would put in one sentence, debugging It is a two step process, first the location of the failure and then the fixing of the issue. The debugging process relies on developers questions but also relies on tools and approaches.

Modern debugging tools employ sophisticated mechanisms to help answering this question, however sometimes, actually most of the times, it is not enough just to use tools to find answers, it’s actually necessary to use several approach/more than one sometimes, to find the causes of issues.

1.Try and fail approach

For small development problems, the try and fail approach is effiencient and ok. However, to bigger problems we need to change the way to solve them actually.

2.Questions

1. Why? Chain of failure.
2. What? Related to entity level.
3. Whether? Set of events on the

3.Hypothesis thesis

The questions can be used combined with hypothesis testing, which is a quite interesting and reliable approach to solve problems on code that you know and code that you don’t know.

REFs

[1] How Did the Failure Come to Be? Mohammadreza Azadmanesh and Matthias Hauswirth. CoCos’17, October 23, 2017, Vancouver, Canada.

 

 

 

 

Turtle in Python

All

2Intro

I was playing a bit on python, as usual, and I came again with the Turtle built-in module. That’s an amazing module that remembers me the good days of Logo, Rip Seymont Paper.

Turtle

Such a cool module, it’s totally underrated. Well, at least on my side. Make sure to not name the module turtle, As I did, it won’t work obviously.

import turtle

silly = turtle.Turtle()

silly.forward(50)
silly.right(90)     # Rotate clockwise by 90 degrees

silly.forward(50)
silly.right(90)

silly.forward(50)
silly.right(90)

silly.forward(50)
silly.right(90)

turtle.done()

The references can be found here [1] and some codes I’ve done can be found here [2]. It’s very simple, pretty much like logo.

Simple things like square and circles are done with just one line.

REFs

[1] https://docs.python.org/2/library/turtle.html

[2]https://github.com/FranciscoMeloJr/Python-Tests