Friday, June 22, 2012

Perl - [FILE CONF / Config::IniFiles ]

configfile.ini --------------------------------------------------------------------------------------------------------------  [db] user = Command Line pass = 123 -------------------------------------------------------------------------------------------------------------- blog.pl --------------------------------------------------------------------------------------------------------------  #!/usr/bin/perl use...

Tuesday, June 12, 2012

PERL - Validate Palindromo

validate.pl -------------------------------------------------------------------------------------------------------------- #!/bin/bin/perl use strict; use warnings; my $palavra = shift or die $!; my @array = split(//,$palavra); my ($max,$valida) = ($#array,0); for(my $i = 0; $i <= $#array/2; $i++  ){     if($array[$i] eq $array[$max]){           ...

Perl - [ SCRIPT TO BACKUP ]

 backup.pl ------------------------------------------------------------------------------------------------------------ #!/usr/bin/perl use strict; use warnings; my $path = shift or die $!; my $dir_out = 'backup_Perl'; `mkdir $dir_out`    unless (-e "$dir_out"); print `find $path -name "*.pl" > tmp_path_backup`; open (IN,"tmp_path_backup") or die $!; while(<IN>){    ...

Sunday, June 10, 2012

Friday, June 8, 2012

Mysql && Perl / [ toGenerate_TIME | Show ]

toGenerate_TIME.pl ------------------------------------------------------------------------------------------------------------------------- #!/usr/bin/perl use strict; use warnings; my $myInterval = shift or die print "Usage : ./toGenerate_TIME.pl 30\n $!"; my $Time_start = 0; my $Time_stop = 23; my $interval = 0; print "create table horas(id int(10) primary key  auto_increment, horario...

Mysql [ if / else | DATA / TIME ]

Sintaxe : IF(<condition>, <value if true>, <value if false>) mysql> create table reserva(id int(10) primary key  auto_increment, tempo time, data date); Query OK, 0 rows affected (0.08 sec) mysql> desc reserva; +-------+---------+------+-----+---------+----------------+ | Field | Type    | Null | Key | Default | Extra        ...

Mysql [Time/Data] / Select|Insert

mysql> create table reserva(id int(10) primary key  auto_increment, tempo time, data date); Query OK, 0 rows affected (0.08 sec) mysql> desc reserva; +-------+---------+------+-----+---------+----------------+ | Field | Type    | Null | Key | Default | Extra          | +-------+---------+------+-----+---------+----------------+ | id    | int(10)...

Thursday, June 7, 2012

Mysql [ Date ] Insert/Select

mysql> create table usr( id int(10) primary key auto_increment, nome longtext, data date); Query OK, 0 rows affected (0.10 sec) mysql> insert into usr (nome,data) values('andre','1990-04-07'); Query OK, 1 row affected (0.00 sec) mysql> insert into usr (nome,data) values('marcelo','1994-03-31'); Query OK, 1 row affected (0.00 sec) mysql> insert into usr (nome,data) values('baby',CURDATE()); Query...