Skip to content

Instantly share code, notes, and snippets.

View faogustavo's full-sized avatar

Gustavo Fão Valvassori faogustavo

View GitHub Profile
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.XMLEvent;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
@faogustavo
faogustavo / MainActivity.Java
Last active February 28, 2016 19:30
Uma forma de facilitar o uso do SearchView com a Toolbar
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
{
"data":[
{
"type":"all_types",
"id":"ID",
"attributes":{
"mBoolean":false,
"mChar":71,
"mDouble":15.256,
"mFloat":15.255999565124512,
DROP PROCEDURE IF EXISTS `registrar_usuario` ;
DROP PROCEDURE IF EXISTS `registrar_endereco` ;
DROP PROCEDURE IF EXISTS `registrar_revenda` ;
DELIMITER $$
-- Procedure OK
CREATE PROCEDURE registrar_endereco(
IN stateName VARCHAR(64),
IN stateInitials CHAR(2),
DROP TRIGGER IF EXISTS `t_demissao`;
DELIMITER $$
CREATE TRIGGER t_demissao BEFORE UPDATE
ON user
FOR EACH ROW
BEGIN
IF NEW.state = 'I' THEN
SET NEW.resignation_date = NOW();
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 30-Jun-2016 às 03:39
-- Versão do servidor: 10.1.8-MariaDB
-- PHP Version: 5.6.14
SET FOREIGN_KEY_CHECKS=0;
CREATE OR REPLACE VIEW revendas AS
SELECT
r.name as 'Nome',
count(uhr.user_id) as 'Funcionários',
a.street as 'Rua',
a.number as 'Numero',
a.complement as 'Complemento',
d.name as 'Bairro',
c.name as 'Cidade'
FROM resale r
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class SortedList<T> extends ArrayList<T> {
public enum SortOrder {ASC, DESC}
class Principal {
Arquivo arquivo = new Arquivo();
public static void main(String args[]) {
new Principal().executa();
}
public void executa() {
arquivo.lerDados();
}
import java.util.List;
/**
* Created by faogustavo on 20/09/2016.
*/
public class Rule implements IRule{
private Rule next;
private static final String CORINGA = "*";