segunda-feira, 3 de outubro de 2011

Gerenciamento de TI com XGH (eXtreme Go Horse Process)

eXtreme Go Horse Process (XGH)



Finalmente eu encontrei algo que se encaixa perfeitamente na minha experiência profissional, ano após ano escutando uma hipocrisia muito bem tramada e agora eu finalmente achei algo que retrata a realidade da vida de um desenvolvedor.

No blog gohorseprocess.wordpress.com eu consegui encontrar uma definição documentada de como eu trabalhei todos esses anos.

Simplesmente totalmente excelente.

Vejam alguns trechos da definição da eXtreme Go Horse Process:

1- Pensou, não é XGH.

XGH não pensa, faz a primeira coisa que vem à mente. Não existe segunda opção, a única opção é a mais rápida.

4- XGH é totalmente reativo.

Os erros só existem quando aparecem.

5- XGH vale tudo, só não vale dar o toba.

Resolveu o problema? Compilou? Commit e era isso.

7- XGH não tem prazo.

Os prazos passados pelo seu cliente são meros detalhes. Você SEMPRE conseguirá implementar TUDO no tempo necessário (nem que isso implique em acessar o BD por um script malaco).

9- Seja autêntico, XGH não respeita padrões.

Escreva o código como você bem entender, se resolver o problema, commit e era isso.

10- Não existe refactoring, apenas rework.

Se der merda, refaça um XGH rápido que solucione o problema. O dia que o rework implicar em reescrever a aplicação toda, pule fora, o barco irá afundar (Vide Axioma 8).

12- Se iluda sempre com promessas de melhorias.

Colocar TODO no código como uma promessa de melhoria ajuda o desenvolvedor XGH a não sentir remorso ou culpa pela cagada que fez. É claro que o refactoring nunca será feito (Vide Axioma 10).

14- XGH é atemporal.

Scrum, XP… tudo isso é modinha. O XGH não se prende às modinhas do momento, isso é coisa de viado. XGH sempre foi e sempre será usado por aqueles que desprezam a qualidade.

19- Se tiver funcionando, não rela a mão.

Nunca altere, e muito menos questione um código funcionando. Isso é perda de tempo, mesmo porque refactoring não existe (Vide Axioma 10). Tempo é a engrenagem que move o XGH e qualidade é um detalhe desprezível.

20- Teste é para os fracos.

Se você meteu a mão num sistema XGH, é melhor saber o que está fazendo. E se você sabe o que está fazendo, vai testar pra que? Testes são desperdício de tempo, se o código compilar, é o suficiente.

21- Acostume-se ao sentimento de fracasso iminente.

O fracasso e o sucesso andam sempre de mãos dadas, e no XGH não é diferente. As pessoas costumam achar que as chances do projeto fracassar utilizando XGH são sempre maiores do que ele ser bem sucedido. Mas sucesso e fracasso são uma questão de ponto de vista. O projeto foi por água abaixo mas você aprendeu algo? Então pra você foi um sucesso!

Quem um dia já programou em uma empresa com certeza está sentindo uma empatia forte.

Aquele abraço.


quarta-feira, 29 de junho de 2011

Linux DHCP Server atribuindo IP pelo Option-82 Circuit-ID



Instalando o DHCPD no linux (UBUNTU/DEBIAN)

1º ) Instalando DHCPD

# apt-get install dhcp3-server

2º) Configurando syslog

# vi /etc/rsyslog.d/S50default.conf

Inserir as linhas:

#
#  DHCP3-SERVER LOG
#
local7.debug            /var/log/dhcpd.log


3º) Criar arquivo de log

# touch /var/log/dhcpd.log

3º) Reiniciar o SYSLOG:

# service rsyslog restart

4º) Inserir no dhcpd.conf a linha:

log-facility local7;


5º) Iniciar o DHCP Server:

#/etc/init.d/dhcp3-server start


6º) Realizando DEBUG:

Inserir no dhcpd.conf o comando para debug:

log ( info, option agent.circuit-id );


Isso fará com quem apareça no log /var/log/dhcpd.log as informações do client dhcp, mas isso apenas se ocorrer o lease do ip!!!
Então o ideal é criar uma configuração bem básica que atribua um ip para o cliente, apenas para poder ver no log as informaçãos do pedido DHCP do cliente.
 

Exemplo: root@ubuntu:/etc/dhcp3# cat dhcpd.conf
 

ddns-update-style none;
option domain-name "meudomain";
option domain-name-servers 8.8.8.8;

default-lease-time 600;
max-lease-time 7200;

# habilitar local7 como dhcp no syslog
log-facility local7;

subnet 192.168.20.0 netmask 255.255.255.0 {
  range 192.168.20.10 192.168.20.20;
  option routers 192.168.20.1;
}

# ELE SO LOGA NO OFFER
log( info, option agent.circuit-id);


Verificar no LOG as informações de circuit-id:

# tail –f /var/log/dhcpd.log

Jun 29 10:45:06 ubuntu dhcpd: olt1-gpon xpon 0/1/0/0:0.40.40
Jun 29 10:45:06 ubuntu dhcpd: DHCPREQUEST for 192.168.20.40 from 00:11:11:90:5b:29 (clientpc) via eth0
Jun 29 10:45:06 ubuntu dhcpd: DHCPACK on 192.168.20.10 to 00:11:11:90:5b:29 (clientpc) via eth0




 
Também é possível verificar no leases:

root@ubuntu:/etc/dhcp3# tail -f /var/lib/dhcp3/dhcpd.leases
  starts 3 2011/06/29 13:45:06;
  ends 3 2011/06/29 13:55:06;
  cltt 3 2011/06/29 13:45:06;
  binding state active;
  next binding state free;
  hardware ethernet 00:11:11:90:5b:29;
  uid "\001\000\021\021\220[)";
  option agent.circuit-id "olt1-gpon xpon 0/1/0/0:0.40.40";
  client-hostname "clientpc";

Este circuit-id está sendo inserido como string pelo roteador.


Agora que sabemos qual o circuit-id, podemos criar uma configuração para entregar os IPs baseados no circuit-ID de cada usuário:


ddns-update-style none;
option domain-name "mydomain";
option domain-name-servers 8.8.8.8;

default-lease-time 600;
max-lease-time 7200;

# habilitar local7 como dhcp no syslog
log-facility local7;

subnet 192.168.20.0 netmask 255.255.255.0 {
  option routers 192.168.20.1;

  class "uservlan40" {
        match if option agent.circuit-id = "olt1-gpon xpon 0/1/0/0:0.40.40";
  }

  pool {
        range 192.168.20.40;
        allow members of "uservlan40";
  }

  class "uservlan30" {
        match if option agent.circuit-id = "olt1-gpon xpon 0/1/0/0:0.30.30";
  }

  pool {
        range 192.168.20.30;
        allow members of "uservlan30";
  }
}

# ELE SO LOGA NO OFFER
log( info, option agent.circuit-id);



Também é interessande deixar o WIRESHARK capturando pacotes, e colocar como filtro "bootp" para filtrar apenas os pacotes de DHCP. Pelo wireshark é possível ver todas as options do pacote DHCP, circuit-id e remote-id.




Linux Ubuntu losing static IP address on disconnect

If you are losing the interface static IP address on disconnect in your Linux Ubuntu 9.x , this happens because Ubuntu has its own network manager and probably you're trying to configure the static IP in the usual way, editing the config file /etc/network/interfaces.

There are two solutions:


1) Use the Network-Manager

1.1) Remove all manually configurations from /etc/network/interfaces

The file  /etc/network/interfaces  should be like this:

auto lo
iface lo inet loopback

 1.2) Configure your network interface static IP address through the Network-Manager in Gnome panel.

1.3) Restart Network-Manager service:

# service network-manager restart
 

2) Stop Network-Manager Service

2.1) Stop Network-Manager service with:


# service network-manager stop

2.2) To permanently disable Network-Manager
edit /etc/init/network-manager.conf and comment the line

## exec NetworkManager

2.3) Configure your network in the usual way (manually), editing /etc/network/interfaces

# vi /etc/network/interfaces 
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.1

Restart the network service:


# ./etc/init.d/networking restart

For more information about this issue: 
  1. http://en.kioskea.net/faq/979-having-a-static-ip-address-under-ubuntu-8-10
  2. http://www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/

I hope this information helps.





terça-feira, 26 de outubro de 2010

DEBIAN - Caracteres estranhos no terminal console BASH

Caracteres estranhos charset na console bash
Caracteres especiais no terminal do Debian



DEBIAN PORTUGUÊS BRASIL /  PT-BR
CARACTERES APARECEM ERRADO NO TERMINAL

Exemplo : "Diretório do Banco"

Como resolver:

1) dpkg-reconfigure locales

2) selecionar pt_BR ISO-8859-1
O dpkg-reconfigure reconfigura o sistema automaticamente e gera os arquivos:
/etc/locale.gen
/etc/console-tools/config

3) Tem duas variáveis de ambientes que definem a linguagem:
LANG=pt_BR
LANGUAGE=pt_BR:pt:en

são definidas em:
/etc/default/locale

4) Testar se resolveu o problema:

sexta-feira, 22 de outubro de 2010

Debian 5.0 Lenny and VLC not running videos - Solved

keywords: videolan vlc debian 5.0 lenny package no suitable decoder does not support this sound or video format vmware green screen

# uname -a : Linux .6.26-2-686 #1 SMP 2010 GNU/Linux
# cat /etc/issue : Debian GNU/Linux 5.0
# vlc --version : VLC version 0.8.6h Janus


THE PROBLEM:

If you installed vlc on debian with apt-get:

# apt-get install vlc

Desempacotando libavcodec51 (de .../libavcodec51_3%3a20080706-0.3lenny2_i386.deb) ...
Desempacotando libavformat52 (de .../libavformat52_3%3a20080706-0.3lenny2_i386.deb) ...
Desempacotando libvlc0 (de .../libvlc0_0.8.6.h-4+lenny2.3_i386.deb) ...
Desempacotando vlc-nox (de .../vlc-nox_0.8.6.h-4+lenny2.3_i386.deb) ...
Desempacotando vlc (de .../vlc_0.8.6.h-4+lenny2.3_i386.deb) ...


And when you run VLC you have this error:

$ vlc media.avi -v
VLC media player 0.8.6h Janus
[00000304] main decoder warning: cannot load module /usr/lib/vlc/codec/libffmpeg_plugin.so' (/usr/lib/vlc/codec/libffmpeg_plugin.so: undefined symbol: img_resample)
[00000304] main decoder error: no suitable decoder module for fourcc div3.
VLC probably does not support this sound or video format.
[00000281] main playlist: nothing to play
[00000281] main playlist: stopping playback


The problem:

libavcodec version in multimidia repositories is not working properly with VLC version 0.8.6h Janus.

The solutions:

# Solution 1 )
Clear cache files:
rm -rf /home/[you_user]/.vlc
run vlc
(maybe work)

# Solution 2
1) remove libavcodec51 and vlc
# apt-get remove libavcodec51
# apt-get remove vlc

2) Comment the "multimidia repo" in your /etc/apt/sources.list :

#multimidia mirrors
#deb http://debian-multimedia.org/ lenny main
#deb http://ftp.debian-unofficial.org/debian lenny main contrib non-free

add the official vlc repositories in sources.list

# vlc official repositories
deb ftp://ftp.br.debian.org/debian/ lenny main contrib non-free
deb http://linorg.usp.br/debian/ lenny main contrib non-free

3) Update packages
#apt-get update

4) Reinstall libavcodec51 and vlc
# apt-get install libavcodec51
# apt-get install vlc

# apt-get install libavcodec51
Desempacotando libavcodec51 (de .../libavcodec51_0.svn20080206-18+lenny1_i386.deb) ...
# apt-get install vlc
Desempacotando libavformat52 (de .../libavformat52_0.svn20080206-18+lenny1_i386.deb) ...
Desempacotando libvlc0 (de .../libvlc0_0.8.6.h-4+lenny2.3_i386.deb) ...
Desempacotando vlc-nox (de .../vlc-nox_0.8.6.h-4+lenny2.3_i386.deb) ...
Desempacotando vlc (de .../vlc_0.8.6.h-4+lenny2.3_i386.deb) ...

5) Try run vlc again:
$ vlc
Try to open some media files.
It should work!

VLC GREEN SCREEN IN VMWARE

If your VLC run the audio with a green square in place of the video, the problem is your "video output". You can change by command-line:
$ vlc -V X11
$ vlc -V xvideo
$ vlc -V opengl
try to see which work to you.
I'm running debian in a vmware, so only X11 module worked for me, the opengl module show me the green screen.
To make this a permanent configuration open vlc interface:






Configuration -> Preferences -> Video -> Click over "Output Modules" -> Select "Advanced Options" -> Video output module -> Select the apropriate module that work to you.







Tell me if these solutions worked to you.

Sorry for my bad english.
Author: Rodrigo Eggea

segunda-feira, 11 de janeiro de 2010

HOW TO RECORD MMS TO A FILE
LINUX MPLAYER

# mplayer -noframedrop -dumpfile outfile.wma -dumpstream mms://media1.broadneeds.com.br/91rock

# mencoder mms://address.of.site/movie.wmv -ovc copy -oac copy -o output.avi

segunda-feira, 4 de janeiro de 2010

blue screen and reboot after clonning harddisk

Yesterday I cloned a 30Gb with windows xp to a 60Gb IDE Hard Disk using a Linux Live CD (System Rescue CD) and the command "dd" (disk druid)

Sintax:
# dd if=/dev/hda of=/dev/hdd

Problem:
after clonning and swap the disks windows xp started to give me blue screen of death and rebooted at logo screen.
I tried to boot with windows xp instalation cd and repair windows instalation (no sucess)
I tried to boot in Safe Mode and in device manager delete harddisk drivers and IDE ATA Controllers and reboot (worked but not for a long time)

Solution:
The problem was that I changed the IDE cable of the HardDisk.
I thought that the IDE flat cables are all the same thing, but I was wrong, some IDE cables are different, or maybe my cable was damaged.
After using the cable that was there before, windows started with no problems.

So, pay atention to the IDE cables after clonning disks.

After clonning a disk to a larger one, you need a program like "Partition Magic" to resize the partition to the full size of the disk.

Some reference:
http://www.pchell.com/hardware/masterslaveorcableselect.shtml

GOLPE LIGAÇÃO DE FALSO FUNCIONÁRIO DA CAIXA SOBRE DÍVIDA OU COMPRA NO MERCADO LIVRE

💥💥💥 ALERTA DE GOLPE DO FALSO FUNCIONÁRIO DE BANCO 💥💥💥 Se você receber uma ligação dizendo ser de algum banco como  CAIXA ECONÔMICA FED...