Hospedagem Profissional

Hospedagem Profissional
Clique aqui e ganhe US$ 10,00 para testar durante 1 mês a melhor hospedagem: Digital Ocean!

terça-feira, 6 de dezembro de 2016

Como instalar o Oracle Java 8 no Linux (Debian) via repositório e receber atualizações automáticas

Este é um ótimo tutorial para quem vive tendo que atualizar manualmente o Java no Linux. Browsers como o Firefox impedem ou dificultam muito a vida de quem precisa acessar bancos por exemplo se o plugin do Java estiver desatualizado. Seguindo as dicas abaixo, após a instalação do Java, o mesmo será atualizado automaticamente.


A quick tip for Debian users who want to install and stay up to date with the latest Oracle Java 8 (JDK8): the WebUpd8 Java 8 PPA works on Debian too since the package is just an installer and all you have to do is manually add the PPA repository to the Software Sources.


As a reminder, the Oracle Java 8 PPA repository does not host any Java files but only an installer that automatically downloads and installs Oracle Java 8, like the flashplugin-installer package for instance.


To add the WebUpd8 Oracle Java PPA repository to the Software Sources in Debian (tested on Debian Squeeze, but it should work with any Debian version), use the following commands:

 su -  
 echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list  
 echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list  
 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886  
 apt-get update  
 apt-get install oracle-java8-installer  
 exit  

And that's it, Oracle Java 8 (both JDK8 and JRE8) should now be installed and you should receive automatic updates with future Oracle Java 8 versions, under Debian.

Setting Java environment variables


To automatically set up the Java 8 environment variables, you can install the following package:

 sudo apt-get install oracle-java7-set-default  

If you've already installed oracle-java6-set-default or oracle-java7-set-default, they will be automatically removed when installing oracle-java7-set-default (and the environment variables will be set for Oracle Java 8 instead).

Fonte: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html

segunda-feira, 30 de maio de 2016

Script para monitorar espaço em disco e avisar por e-mail no Linux

Esse script monitora o espaço em disco do Linux, e quando atingir uma taxa de ocupação mínima (no caso abaixo 90%) ele avisa por e-mail ao responsável.

Agende a execução no crontab e pronto. Recomendo 1 vez ao dia.

OBS.
  1. No script abaixo, foram ignorados os filesystems "Sist|tmpfs|/mnt/backup"
  2. Quando a ocupação é maior que 90%, é enviado no e-mail a lista das 10 maiores pastas para facilitar a identificação dos "comedores de disco"



#!/bin/sh
# Shell script para monitorar o espaço em disco
# Irah enviar um email para $ADMIN, se o espaço em disco ocupado
# for maior que 90%
# Autor: Leandro Silva Ferreira
ADMIN="seuemail@seudominio.com"
ALERT=90

df -H | grep -vE '^Sist|tmpfs|/mnt/backup' | awk '{ print $5 " " $1 }' | while read output;
do
  echo $output

  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )
  partition=$(echo $output | awk '{ print $2 }' )

  if [ $usep -ge $ALERT ]; then
     biggers=$(cd / | du -hsx * | sort -rh | head -10)

     echo -e "Espaço em disco crítico em  \"$partition ($usep%)\" no servidor $(hostname) em $(date) \\n\\nMaiores pastas na raiz:\\n$biggers" |
     mail -s "Alerta: Espaço em disco do servidor $(hostname) está no limite: $usep %" $ADMIN
  fi
done

quinta-feira, 14 de janeiro de 2016

Ferramentas essenciais para o desenvolvedor Java




shutterstock_124013509_javagears
It’s as true for Java developers as it is for woodworkers: You can’t do the job right without the right tools. Fortunately, there are plenty of Java tools designed to make it significantly simpler to write good Java code — and help you make your Java code even better.
You’ll probably know many of the tools on this list of 18 choices, but others may be new to you. And odds are you haven’t tried them all yet!
  1. GradleBuild tool. Automates the building, testing, publishing, deployment, and more of software as well as generating static websites or documentation.
  2. EclipseOpen-source integrated development environment (IDE). If you could have just one tool for Java development, Eclipse would be a good choice.
  3. IntelliJIDE made by JetBrains, available in an Apache 2-licensed community edition and a commercial edition. IntelliJ provides similar features to Eclipse, with a smooth, developer-friendly experience.
  4. YourKitJava profiler. Combines powerful analysis capabilities, on-demand profiling during both development and production, free embedding into production, and seamless IDE and application server integration.
  5. Clover: Code coverage tool from Atlassian. Runs in your IDE or continuous integration system, and includes test optimization to make tests run faster and fail sooner.
  6. MockitoMock library. Open-source testing framework that enables the creation, verification, and stubbing of mocks.
  7. Jetty: Lightweight, embeddable app server.
  8. Hibernate: Object-relational mapper. Implements the Java persistence API.
  9. VisualVMJVM monitor. An all-in-one Java troubleshooting tool that comes with the JDK.
  10. JUnit: Unit test framework. Core tool of test-driven development that enables repeatable, white-box testing.
  11. Jenkins: Continuous integration tool. Customizable with more than 600 plugins.
  12. Spring Boot: Spring application development system. Works in your build system. Supports Gradle and Maven.
  13. Guice: Lightweight dependency injection/inversion of Control (IoC) framework, from Google.
  14. Guava: Utility library. Contains core libraries that Google relies on in Java-based projects: collections, caching, primitives support, concurrency libraries, common annotations, string processing, I/O, and so forth.
  15. FindBugs: Static code analyzer. Classifies potential errors in code as scariest, scary, troubling, or “of concern.” Available as a standalone GUI or as a plugin for Eclipse, NetBeans, IntelliJ, Gradle, Hudson, and Jenkins.
  16. Jackson: JSON parser. Aims to be fast, correct, lightweight, and ergonomic for developers.
  17. Snappy:Compression/decompression library from Google Code. A great resource when speed is a requirement.
  18. JD-GUI: Decompiler. Standalone graphic utility that displays source codes of “.class” files. Free for non-commercial use (i.e., can’t be included or embedded in commercial products).
Of course, don’t forget New Relic Java Monitoring,the best way to see everything in your Java applications. With New Relic, you can pinpoint code-level application performance issues quickly so you can fix them faster.
Fonte: https://blog.newrelic.com/2014/05/21/toolsforjavadevelopers/