This is default featured post 1 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured post 2 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured post 3 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured post 4 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
This is default featured post 5 title
Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.
Falha no Skype favorece divulgação de IPs
Bug no Firefox WebSocket compromete o anonimato do Tor
Brasil ultrapassa Índia e se torna segundo país com mais usuários no Facebook
Checar se CNPJ ou CPF são válidos
unit DVs; { DVs.Pas - Copyleft (1997) - Ivan C Cruz. ivancruz@centroin.com.br www.forumbr.com VocÍ pode distribuir, utilizar e alterar livremente estas rotinas desde que mantenha este coment·rio que identifica o autor original. } interface function DvModulo11 ( str: String ): Char; function DvModulo10 ( str: String ): Char; function DvCGC ( str: String ): String; function DvCPF ( str: String ): String; function ValidaCGC ( str: String ): Boolean; function ValidaCPF ( str: String ): Boolean; implementation { chInt - Converte um caracter numÈrico para o valor inteiro correspondente. } function chInt ( ch: Char ): ShortInt; begin Result := Ord ( ch ) - Ord ( '0' ); end; { intCh = Converte um valor inteiro (de 0 a 9) para o caracter numÈrico correspondente. } function intCh ( int: ShortInt ): Char; begin Result := Chr ( int + Ord ( '0' ) ); end; { DvModulo11 - Retorna 1 dv calculado pelo mÈtodo do modulo 11 padr„o. } function DvModulo11 ( str: String ): Char; var soma, fator, i: Integer; begin soma := 0; fator := 2; for i := Length ( str ) downto 1 do begin soma := soma + chInt ( str[i] ) * fator; Inc ( fator ); if fator = 10 then fator := 2; end; soma := 11 - ( soma mod 11 ); if soma >= 10 then Result := '0' else Result := intCh ( soma ); end; { dvModulo11ParaCPF - Retorna 1 dv calculado pelo mÈtodo do modulo 11 ligeiramente alterado para o CPF. } function dvModulo11ParaCPF ( str: String ): Char; var soma, fator, i: Integer; begin soma := 0; fator := 2; for i := Length ( str ) downto 1 do begin soma := soma + chInt ( str[i] ) * fator; Inc ( fator ); end; soma := 11 - ( soma mod 11 ); if soma >= 10 then Result := '0' else Result := intCh ( soma ); end; { DvModulo10 - Retorna 1 dv calculado pelo mÈtodo do modulo 10 padr„o. } function DvModulo10 ( str: String ): Char; var soma, fator, i: Integer; begin soma := 0; fator := 2; for i := Length ( str ) downto 1 do begin soma := soma + chInt ( str[i] ) * fator; Dec ( fator ); if fator = 0 then fator := 2; end; soma := 10 - ( soma div 11 ); if soma >= 10 then Result := '0' else Result := intCh ( soma ); end; { DvCGC - Retorna os dois dvs de um CGC, dado o CGC sem os dvs em forma de string (12 caracteres numÈricos). } function DvCGC ( str: String ): String; var dv1: Char; begin dv1 := DvModulo11 ( str ); Result := dv1 + DvModulo11 ( str + dv1 ); end; { DvCPF - Retorna os dois dvs de um CPF, dado o CPF sem os dvs em forma de string (9 caracteres numÈricos). } function DvCPF ( str: String ): String; var dv1: Char; begin dv1 := dvModulo11ParaCPF ( str ); Result := dv1 + dvModulo11ParaCPF ( str + dv1 ); end; { ValidaCGC - Retorna true se o CGC dado È valido. O CGC deve ser um string de 14 caracteres numÈricos. } function ValidaCGC ( str: String ): Boolean; begin Result := Copy ( str, 13, 2 ) = DvCGC ( Copy ( str, 1, 12 ) ); end; { ValidaCPF - Retorna true se o CPF dado È valido. O CPF deve ser um string de 11 caracteres numÈricos. } function ValidaCPF ( str: String ): Boolean; begin Result := Copy ( str, 10, 2 ) = DvCPF ( Copy ( str, 1, 9 ) ); end; end.
Validação de CPF
<cfscript> /** * Checa se um CPF específico (Brasil) é válido. * * @param inputCPF O CPF (000.000.000-00) para checar. * @return Retorna um boolean. */ function CPFvalidate(thisCPF) { var thisCPFdigitos = ""; var thisDigit = 0; var thisCPFlen = 0; var somaDigitoUm = 0; var somaDigitoDois = 0; var digitoUm = 0; var digitoDois = 0; var i = 0; thisCPF = Replace(thisCPF, " ", "", "ALL"); thisCPF = Replace(thisCPF, ".", "", "ALL"); thisCPF = Replace(thisCPF, "-", "", "ALL"); thisCPFlen = len(thisCPF); // Numérico, 11 dígitos e maior que zero (no caso 000.000.000-00) if (NOT (IsNumeric(thisCPF) AND thisCPFlen EQ 11 AND thisCPF GT 0)) return false; // Separa o número e digitos verificadores thisCPFdigitos = right(thisCPF, 2); thisCPF = left(thisCPF, 9); // Por exemplo 111.111.111-11, 222.222.222-22, etc. // O caso 000.000.000-00 é tratato em thisCPF GT 0, acima. // Só faz tal verificação se os dígitos forem maior que zero (não se pode //dividir por zero) if (thisCPFdigitos AND int(thisCPF/thisCPFdigitos) EQ 10101010) return false; for(i=10; i GT 1; i=i-1) { thisDigit = mid(thisCPF, 11-i, 1); somaDigitoUm = somaDigitoUm + thisDigit * i; } digitoUm = somaDigitoUm * 10 MOD 11; if (digitoUm EQ 10) digitoUm = 0; thisCPF = thisCPF & digitoUm; for(i=11; i GT 1; i=i-1) { thisDigit = mid(thisCPF, 12-i, 1); somaDigitoDois = somaDigitoDois + thisDigit * i; } digitoDois = somaDigitoDois * 10 MOD 11; if (digitoDois EQ 10) digitoDois = 0; if (digitoUm & digitoDois EQ thisCPFdigitos) return true; else return false; } </cfscript>
Galeria De Fotos Com Carregamento Externo Simples galeria de foto com carregamento externo das imagens.
import fl.transitions.*
import fl.transitions.easing.*
// ----- Variáveis
var quantidade:uint = 9
var fotaoRequest:URLRequest = new URLRequest ()
var fotaoLoader:Loader = new Loader ()
var conteiner:MovieClip = new MovieClip ()
// ----- Eventos
fotaoLoader.contentLoaderInfo.addEventListener
(ProgressEvent.PROGRESS, carregando)
fotaoLoader.contentLoaderInfo.addEventListener
(Event.COMPLETE, carregou)
// ----- Inicialização
this.addChild( conteiner )
conteiner.addChild( fotaoLoader )
fotaoLoader.x = 3
fotaoLoader.y = 162
for (var i:uint = 0; i < quantidade; i++) {
var novoBtn:Caixa = new Caixa ()
var miniRequest:URLRequest = new URLRequest ()
var miniLoader:Loader = new Loader ()
//
miniRequest.url = "galeria/foto" + i + "_p.jpg"
miniLoader.load( miniRequest )
// Desligamos os eventos de mouse do Loader
miniLoader.mouseEnabled = false
//
this.addChild( novoBtn )
with ( novoBtn ) {
alpha = 0.3
addChild( miniLoader )
x = width * i
y = 572
addEventListener(MouseEvent.CLICK, clicou)
addEventListener(MouseEvent.MOUSE_OVER, over)
addEventListener(MouseEvent.MOUSE_OUT, out)
}
// Criamos uma var embutida no MC
novoBtn.minhaFotao = "galeria/foto" + i + ".jpg"
}
// ----- Funções
function over (e:MouseEvent) {
e.target.alpha = 1
}
function out (e:MouseEvent) {
e.target.alpha =0.3
}
function clicou (e:MouseEvent) {
fotaoRequest.url = e.target.minhaFotao
fotaoLoader.load( fotaoRequest )
}
function carregando (e:ProgressEvent) {
var carregados:uint = e.target.bytesLoaded
var totais:uint = e.target.bytesTotal
var conta:Number = carregados / totais
//
barra_mc.scaleX = conta
//
barra_mc.visible = true
}
function carregou (e:Event) {
barra_mc.visible = false
TransitionManager.start(conteiner,{type:Fade, duration:2})
}
Carregando Noticia Via Xml - Simples sistema de carregamento de noticias com imagem via xml
- Crie 1 Movie clip para a Imagem e instancie como foto
- Incira um campo dinamico e instancie como titulo
- Insira outro campo dinamico e instancie como noticia
Crie um outro Layer e insira o Action Script Abaixo
// ------- variáveis
var noticiaRequest:URLRequest = new URLRequest ()
var noticiaLoader:URLLoader = new URLLoader()
var noticiaXML:XML
var imagemRequest:URLRequest = new URLRequest ()
var imagemLoader:Loader = new Loader ()
// ------- Eventos
noticiaLoader.addEventListener(Event.COMPLETE, ok)
// ------- Funções
function ok (e:Event) {
noticiaXML = new XML (noticiaLoader.data)
//
titulo.text = noticiaXML.*[0].@nome
noticia.text = noticiaXML.*[0].@mensagem
imagemRequest.url = noticiaXML.*[0].@foto
imagemLoader.load(imagemRequest)
this.addChild (imagemLoader)
imagemLoader.x = imagemLoader.y = 10
}
// ------ Inicialização
noticiaRequest.url = "noticia.xml"
noticiaLoader.load (noticiaRequest)
---------------------------------------------------------------------------------------------------------------------
Agora vamos ao noticia.xml
Basta usar seu editor favorito no meu caso o Dreamweaver e insira os códigos abaixo:
<?xml version="1.0" encoding="UTF-8"?>
<noticias>
<noticia nome="Novo filme da Pixar - Wall-e" mensagem="Cerca de 700 anos no futuro, a Terra está infestada por poluentes. Por isso, os humanos vivem numa nave que percorre a atmosfera do planeta. Um robô que vive na Terra coletando lixo se apaixona por uma máquina que está na companhia dos humanos, no espaço. Assim, ele sai numa jornada para se juntar a ela." foto="walle.jpg" />
</noticias>