This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Caminho do servidor mysql: | |
$servidor = "localhost"; | |
# Nome do usuário do mysql: | |
$usuario = "root"; | |
# Senha do usúario do mysql: | |
$senha = "senha123456"; | |
# Nome do banco de dados: | |
$banco = "meu_banco" | |
# Conecta com o servidor: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Caminho do servidor mysql: | |
$servidor = "localhost"; | |
# Nome do usuário do mysql: | |
$usuario = "root"; | |
# Senha do usúario do mysql: | |
$senha = "senha123456"; | |
# Nome do banco de dados: | |
$banco = "meu_banco" | |
# Conecta com o servidor: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Caminho do servidor mysql: | |
$servidor = "localhost"; | |
# Nome do usuário do mysql: | |
$usuario = "root"; | |
# Senha do usúario do mysql: | |
$senha = "senha123456"; | |
# Nome do banco de dados: | |
$banco = "meu_banco" | |
# Conecta com o servidor: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String dataHoraAtual = new SimpleDateFormat("dd/MM/yyyy H:m:s").format(new Date()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
public class VerificaExistenciaArquivo | |
{ | |
public static void main (String [] args) | |
{ | |
// Cria uma instancia da classe File: | |
File arquivo = new File("C://arquivo.pdf"); | |
// Usa a função exists para verificar se o arquivo existe ou não: | |
if (arquivo.exists()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mostrar a UNIX Time atual | |
*/ | |
public class UnixTime | |
{ | |
public static void main(String[] args) | |
{ | |
// Pegamos o tempo em milisegundos e dividimos por 1000 para pegar os segundos: | |
long unixTime = System.currentTimeMillis() / 1000; | |
System.out.println(unixTime); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Classe para funções de tratamento de data. | |
*/ | |
public class Data | |
{ | |
/** | |
* Função para formatar o tempo em segundos para HH:MM:SS | |
* @param tempoSegundos Tempo gasto em segundos | |
* @return String Tempo formatado | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Formatação de datas usando a função date: | |
$dataNormal = "2015-01-07"; | |
$dataConvertida = date("d/m/Y", strtotime($dataNormal)); | |
print $dataConvertida; // 07/01/2015 | |
$dataNormal = "07/01/2015"; | |
//Obs.: É necessário substituir a barra por traço | |
$dataConvertida = date("Y-m-d", strtotime(str_replace("/", '-', $dataNormal))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unicodedata import normalize | |
class TextUtil : | |
""" | |
Classe com métodos para tratamento de texto | |
""" | |
def removerCaracteresEspeciais (self, text) : | |
""" | |
Método para remover caracteres especiais do texto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import sys | |
class Portas : | |
""" | |
Classe com métodos para portas | |
""" | |
MAX_PORTAS = 32 # Número máximo de portas para verificação. | |
def getPortasEmUso () : |
OlderNewer