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
unit Strings; | |
interface | |
uses | |
Windows, Dialogs, Messages, SysUtils, Classes, Controls, StdCtrls, Mask; | |
function ArredontaFloat(x : Real): Real; | |
function RoundNum(Valor:Extended;Decimais:Integer):Extended; | |
function Gerapercentual(valor:real;Percent:Real):real; |
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
ref_arquivo = open("COTAHIST_A2016.TXT","r") | |
# formata uma data do tipo yyyymmdd para dd/mm/yyyy | |
def formata_data(data): | |
return data[6:8] + '/' + data[4:6] + '/' + data[0:4] | |
def formata_numero(numero): | |
return int(numero) / 100 | |
for linha in ref_arquivo: |
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 if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
// http://jeromejaglale.com/doc/php/codeigniter_models | |
// Salvar em : application/core/MY_Model.php | |
class MY_Model extends CI_Model { | |
var $table = ""; | |
function __construct() | |
{ | |
parent::__construct(); |
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
function DataExtenso(Data:TDateTime): String; | |
var | |
NoDia : Integer; | |
DiaDaSemana : array [1..7] of String; | |
Meses : array [1..12] of String; | |
Dia, Mes, Ano : Word; | |
begin | |
DiaDasemana [1]:= 'Domingo'; | |
DiaDasemana [2]:= 'Segunda-feira'; | |
DiaDasemana [3]:= 'Terçafeira'; |
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
Select l1.sid, | |
' esta bloqueando ' "Esta bloqueando", | |
l2.sid, | |
' matar esse => ' "Matar esse", | |
l1.sid, | |
l3.serial#, | |
'ALTER SYSTEM KILL SESSION '''|| l1.sid || ','|| l3.serial# ||'''' comando | |
From v$lock l1, | |
v$lock l2, | |
v$session l3 |
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
def fib_rec(n): | |
# essa é a condição que fará com que a função pare de chamar ela mesma | |
if n==1 or n==2: | |
return 1 # e retorne algum valor, que nos dois casos será 1 | |
# o retorno da função se não entrar no if que termina a recursão é ela chamar | |
# ela mesmo diminuindo o valor do parâmetro por 1 e depois por 2 e somar os resultados | |
# a função vai diminuindo o valor de n até que entre na função que para a recursão | |
return fib_rec(n-1) + fib_rec(n-2) |
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 time import time | |
start = time() | |
''' | |
Retorna true se o ano é bissexto e false se não for | |
''' | |
def is_leap_year(ano): | |
if (ano % 2 != 0): | |
return False | |
else: |
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 | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class C_administracao extends CI_Controller { | |
function __construct() | |
{ | |
parent::__construct(); | |
} |